开发者

ResourceBundle.getString removed backslash character

I tried to get a resource from a file path from a properties file.

Property File:

info_path=c:\Info\output

Java:

String path = ResourceBundle.getBundle("bundle_name").getString("info_path");

Result: C开发者_StackOverflow:Infooutput

I would need to set the file:

info_path=c:\\Info\\output

Is this the default behavior? or would it depend on the file encoding? The file is using SJIS encoding by the way.


You are better of using forward slash in your property files, instead of some workaround. By the way no matter you are on Unix/Linux or Windows, forward slash works well, in this context at least. After all Java is platform independent. ;)

P.S. Its better to use relative path.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜