문제

protected static ResourceBundle bankBundle = ResourceBundle.getBundle("messages.EN.properties");

Is it possible to read properties with dot (.) extension properties name?

도움이 되었습니까?

해결책

Actually ResourceBundle accepts only fully qualified base name of the bundle, with no file extension. In this case it will try to load the bundle of files like this

messages/EN/properties.properties

다른 팁

Definitely, you can use Properties class.

http://docs.oracle.com/javase/6/docs/api/java/util/Properties.html

Also you can refer this sample of Code:

Properties prop = new Properties();
ClassLoader loader = Thread.currentThread().getContextClassLoader();           
InputStream stream = loader.getResourceAsStream("/messages.EN.properties");
prop.load(stream);

I think you should use Property class of java:

(Updated from comments)

Properties prop = new Properties(); 
ClassLoader loader = Thread.currentThread().getContextClassLoader(); 
InputStream stream = loader.getResourceAsStream("/messages.EN.properties");
prop.load(stream);  
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top