Board index » jbuilder » Properties.getProperty() ignores character "\" in the value

Properties.getProperty() ignores character "\" in the value


2004-07-14 06:22:25 PM
jbuilder18
Howdy,
Could someone please tell me why could this happen?
There is a property file props including a key-value pair "logfiledir=
c:\hwebgod" , execute :
String logdir = props.getProperty("c:\logfiledir");
Then string logdir will be "c:logfiledir" ( the char \ is missing ! )
Any hint will be appreciated.
Zerol.
 
 

Re:Properties.getProperty() ignores character "\" in the value

you need to double the backslash
see:
java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html(java.io.InputStream)
java.sun.com/j2se/1.4/ja/docs/ja/api/java/util/Properties.html(java.io.InputStream)
while on the subject: does anyone knows why the backslash displays as
the yen character on japanese systems?
Chris a écrit :
Quote
Howdy,

Could someone please tell me why could this happen?

There is a property file props including a key-value pair "logfiledir=
c:\hwebgod" , execute :

String logdir = props.getProperty("c:\logfiledir");

Then string logdir will be "c:logfiledir" ( the char \ is missing ! )

Any hint will be appreciated.
Zerol.

--
Ludovic
-----------------------------------------
"Les formes qui differencient les etres importent peu
si leur pensees s'unissent pour batir un univers..."
Yoko Tsuno (in 'Les titans' by Roger Leloup)
[The shapes that differenciate beings are not important
if their thoughts unite to build a universe]