getbundle(basename)ResourceBundle java

时间:2011-11-28 07:13:12

标签: java

ResourceBundle中的basename是什么?我有这样的例子和文件

import java.util.Locale;
import java.util.ResourceBundle;

public class Main 
{
      public static void main(String[] argv) throws Exception 
      {
          ResourceBundle rb = ResourceBundle.getBundle("RresourcesDynamic");
          System.out.println(rb.getString("title"));
      }
}
  ///here when i run this program i am getting exception like this
  //Exception in thread "main" java.util.MissingResourceException: Can't                bundle     for base name RresourcesDynamic, locale en_US



  //what is basename what i have to mention in this argument is this file name or what?

ResourcesDynamic.properties ----标题= LEO

提前致谢

1 个答案:

答案 0 :(得分:1)

RresourcesDynamic(源代码中)!= ResourcesDynamic(filename)

Full explanation

简短:ResourceBundle.properties(通常的key = value属性文件)必须存在于类路径