Hi all,
I am using Netbeans V5.0 and using a properties file for an application.
How can I specify where the file is stored WITHOUT using the full path of
the properties
file.
For example, below is a snippet of my code
Properties props = null;
try {
// create a Properties object called "props"
props = new Properties();
File file = new File("C:\\###-01-Semester-1-####\\" +
\\Topic5Database\\src\\config\\database.properties");
FileInputStream in = new FileInputStream(file);
// load the file into the Properties object
props.load(in);
.
.
.
.
Rather than specify the FULL path eg C:\\..... can I just use a relative
path of the
properties file for the above file?
Maybe something like ( I know it is not correct)
File file = new File("..\\config\\database.properties");
Any help appreciated.
tom fredriksen - 23 Feb 2006 10:26 GMT
> How can I specify where the file is stored WITHOUT using the full path of
> the properties
> file.
> Maybe something like ( I know it is not correct)
>
> File file = new File("..\\config\\database.properties");
Why not try it and see how it works?
In most cases paths are relative to some root, f.ex. the directory where
the app i started from or where the data root of the application server
controlling the app. So just write a file to the current directory and
search for the file, that should give you the root of your setup.
/tom