Created
February 1, 2017 22:45
-
-
Save hmenn/75e79941e7918d5539def89814325450 to your computer and use it in GitHub Desktop.
read properties file in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Properties getPropertiesFromFile(String fileName) { | |
Properties properties = null; | |
try { | |
properties = new Properties(); | |
properties.load(getClass().getClassLoader().getResourceAsStream(fileName)); | |
} catch (IOException e) { | |
System.err.println("Error detected"); | |
e.printStackTrace(); | |
} | |
return properties; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment