Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Current directory in java properties file

Is there any way of specifying the current directory in a java properties file?

i.e. something like:

fileLocation={currentDir}/fileName.txt
like image 756
Lehane Avatar asked Jun 10 '09 17:06

Lehane


People also ask

How will you get the current working directory in Java?

In Java, we can use System. getProperty("user. dir") to get the current working directory, the directory from where your program was launched.

What is the use of .properties file?

properties is a file extension for files mainly used in Java-related technologies to store the configurable parameters of an application. They can also be used for storing strings for Internationalization and localization; these are known as Property Resource Bundles.


1 Answers

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.

like image 59
Michael Borgwardt Avatar answered Sep 28 '22 06:09

Michael Borgwardt