File.Separator 在属性中
File.Separator in Properties
我正在使用 java.util.Properties。但是,它无法读取配置文件中的 File.separator。
例如,我将这一行添加到配置文件中。 source.dir = D:/workspace/Temp1\Temp2(注意File.separator用来分隔Temp1和Temp2)
下面一行用于加载属性:
Properties properties = new Properties ();
properties.load(new FileInputStream("configFileAddress"));
结果是:source.dir = D:/workspace/Temp1Temp2(File.Separator被移除)。
谁知道,我该如何解决?
替换:
source.dir = D:/workspace/Temp1\Temp2
收件人:
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 '\'.
我正在使用 java.util.Properties。但是,它无法读取配置文件中的 File.separator。
例如,我将这一行添加到配置文件中。 source.dir = D:/workspace/Temp1\Temp2(注意File.separator用来分隔Temp1和Temp2)
下面一行用于加载属性:
Properties properties = new Properties ();
properties.load(new FileInputStream("configFileAddress"));
结果是:source.dir = D:/workspace/Temp1Temp2(File.Separator被移除)。
谁知道,我该如何解决?
替换:
source.dir = D:/workspace/Temp1\Temp2
收件人:
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 '\'.