开发者

ResourceBundle.getString removed backslash character

开发者 https://www.devze.com 2022-12-10 00:49 出处:网络
I tried to get a resource from a file path from a properties file. Property File: info_path=c:\\Info\\output

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

精彩评论

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

关注公众号