1

I am using java.util.Properties. However, it cannot read File.separator inside the config file.

As an example, I add this line to the config file. source.dir = D:/workspace/Temp1\Temp2 (Note that File.separator is used to separate Temp1 and Temp2)

The below line is used to load propertis:

 Properties properties = new Properties ();
 properties.load(new FileInputStream("configFileAddress"));

The result is: source.dir = D:/workspace/Temp1Temp2 (File.Separator is removed).

Any one knows, how can I fix that?

1 Answers1

0

Replace:

 source.dir = D:/workspace/Temp1\Temp2 

To:

source.dir = D:\\workspace\\Temp1\\Temp2

This field is initialized to contain the first character of the value of the system property file.separator. On UNIX systems the value of this field is '/'; on Microsoft Windows systems it is '\'.

felansu
  • 76
  • 1
  • 9