In my Java Application I have a properties Class (shown below). This class refers to application.properties file on the Linux Server.
What is the correct form to enter the file path, do I need Escape Chars?
Current Properties class:
**
* Properties class used to obtain properties from the
* application.properties file
*/
public class MyProperties {
private static Properties props = new Properties();
static {
try {
//path to file on server
java.io.InputStream in= new FileInputStream("/path/to/file/application.properties");
props.load(in);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Returns a given property by its key
* @param key
* @return
*/
public static String getProperty(String key) {
return props.getProperty(key);
}
}
Should I be using: //path//to//file//application.properties
rather than my current implementation?