Guest User

Untitled

a guest
Dec 20th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. try {
  2. jarLocation = CryoStats.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
  3. confLocation = jarLocation.substring(0, jarLocation.lastIndexOf("/")) + "/config/";
  4. try (FileInputStream input = new FileInputStream(confLocation + "CryoStats.properties");) {
  5. properties.load(input);
  6. HORUS_HOST = properties.getProperty("HORUS_HOST");
  7. HORUS_USERNAME = properties.getProperty("HORUS_USERNAME");
  8. HORUS_PASSWORD = properties.getProperty("HORUS_PASSWORD");
  9. CONNECTION_TIMEOUT = Integer.parseInt(properties.getProperty("CONNECTION_TIMEOUT"));
  10. SOCKET_TIMEOUT = Integer.parseInt(properties.getProperty("SOCKET_TIMEOUT"));
  11. System.out.println("CryoStats.properties loaded.");
  12. } catch (FileNotFoundException ex) {
  13. System.out.println("Error loading properties file");
  14. System.out.println(ex.getMessage());
  15. } catch (IOException ex) {
  16. System.out.println("Error loading properties file");
  17. System.out.println(ex.getMessage());
  18. }
  19. } catch (URISyntaxException ex) {
  20. System.out.println(ex.getMessage());
  21. }
  22.  
  23. jarLocation = /cryostats
  24.  
  25. confLocation = System.getProperty("user.dir") + "/config/";
Add Comment
Please, Sign In to add comment