看了API,没有设置路径的函数
只能放在classpath下吗?最终程序是这样的:
/home/run.bat
/config/message files
/lib/*.jar
用..\config\message取不出来
很想用它的依据本地locale自动使用对应文件的功能。

解决方案 »

  1.   

    getBundle方法本身貌似是不行的 只能用相对路径定位方式
    private static final String DEFAULT_RESOURCE_PATH
            = "resources.languages.resources";
    ResourceBundle resourceBundle
                = ResourceBundle.getBundle(DEFAULT_RESOURCE_PATH, locale);相对路径也可由绝对路径变通转化
    然后在此 fully qualified base name of the resource bundle 所指定的路径下
    放上标识语言所属的MyResources_xx.properties以及默认的MyResources.properties
    即可自动对应吧
      

  2.   

    这个什么意思?
    相对路径也可由绝对路径变通转化 getBundle attempts to locate a property resource file.
    It generates a path name from the candidate bundle name by 
    replacing all "." characters with "/" and appending the string ".properties".
    It attempts to find a "resource" with this name using ClassLoader.getResource. 貌似得从ClassLoader.getResource下手,再去看看