String file = System.getProperty("user.dir") + java.io.File.separatorChar + "lang" + java.io.File.separatorChar + "books";
        System.out.println(file);
        ResourceBundle source = ResourceBundle.getBundle(file);
打印 E:\java\Books\lang\books我的E:\java\Books\lang\有个books_zh_CN.properties文件可Exception in thread "AWT-EventQueue-0" java.util.MissingResourceException: Can't find bundle for base name E:\java\Books\lang\books, locale zh_CN

解决方案 »

  1.   

    System.getProperty("user.dir")得到的是你eclipse的工作路径,用这个吧getContext().getServletContext().getRealPath("/")
      

  2.   

    ResourceBundle从类路径中加载资源,不是从文件系统中加载。
      

  3.   

    你要么将books_zh_CN.properties文件放src目录下(和java文件混摆),然后这样ResourceBundle.getBundle("books");或者依然放文件系统中,然后这样PropertyResourceBundle prb = new PropertyResourceBundle(new FileReader(new File("E:\\java\\Books\\lang\\books_zh_CN.properties")));