I have this: Simple java code that loads in a properties file or an INI
file.
Same thing - compiles and works:
Properties defaultProps = new Properties();
FileInputStream in = new FileInputStream("Test.properties");
defaultProps.load(in);
in.close();
Here's the deal though - it only works if the test.properties file is
located in the same directory as the java file.
meaning d:\Javafiles\Properties.java -the folder javafiles has also the
file Test.Properties in the directory as well.
Is it possible to put the Test.properties file in say the C: drive and
call upon it that way?
I tried this:
FileInputStream in = new FileInputStream("c:\Test.properties");
but i get errors.
Any ideas?
Andreas Wollschlaeger - 20 Nov 2006 19:06 GMT
> I have this: Simple java code that loads in a properties file or an INI
> file.
[quoted text clipped - 20 lines]
>
> Any ideas?
Remember to double backslashes when used in a String literal,
"c:\\Test.properties" should work. Maybe it's even simpler to use a
forward slash : "C:/Test.properties" - avoids the backslash escaping
disease!
HTH
Andreas
Jean-Francois Briere - 20 Nov 2006 19:33 GMT
> avoids the backslash escaping disease!
ha ha! good one :-)