'\' in String

Mathews P Srampikal

Ranch Hand

Posts: 211

posted 14 years ago

I am having problem that , I am reading a properties file wich contains some paths.like JAVA_HOME=C:\Test But once u use the getProperty("JAVA_HOME"); it gives C:Test \ is not taken.but if it is \\ Or / it is reading.What to do for this.

Either use \\ or /. The '\' indicates an escape character, like '\n' for newline, '\a' for the bell or '\\' for single backslash. The Java IO classes will interpret forward slashes the same as the single backslash escape character.