Is there any way of specifying the current directory in a java properties file?
i.e. something like:
fileLocation={currentDir}/fileName.txt Is there any way of specifying the current directory in a java properties file?
i.e. something like:
fileLocation={currentDir}/fileName.txt No. Properties files do not have any builtin macro facilities. You can programmatically get the currect directory of the user running the Java app through the user.dir system property.
I don't know any direct solution for this problem. You can load the URL to the properties file and then load the filename from that file:
ClassLoader loader = YourClass.class.getClassLoader(); URL resourceURL =loader.getResource("check.properties"); String fileToLoad = resourceURL.getPath() + <fileNameFromPropertyFile>;