Question

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: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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top