Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to specify the ResourceBundle file

 
Mullin Yu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i have write a separate class to store the configuration at config.properties.

but, how i can tell the java vm to use it?

e.g. java testdemo

import java.util.ResourceBundle;

public class Resource {
private static final String BUNDLE_NAME = "config";//$NON-NLS-1$

private static ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
...
...
}
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yup, that would work if that were indeed the name of the properties file and it were in the root of the classpath.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic