MyEclipse报错:Can't find bundle for base name dbinfo

Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name dbInfo, locale zh_CN
  at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1427)
  at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1250)
  at java.util.ResourceBundle.getBundle(ResourceBundle.java:777)

 at com.amaker.test.I18NTest.main(I18NTest.Java:9) 

原因: dbInfo_zh_CN.properties,这个配置文件没有放在ClassPath中,
在需要加载该配置文件的地方使用它的全路径即可:

ResourceBundle bundle = ResourceBundle.getBundle("com.sey.crud.info");
driverClass = bundle.getString("driverClass");
url = bundle.getString("url");
user = bundle.getString("user");
password = bundle.getString("password");

按照路径,把配置文件加入ClassPath中就可以了。

你可能感兴趣的:(MyEclipse报错:Can't find bundle for base name dbinfo)