java.util.MissingResourceException

前端 未结 6 1123
你的背包
你的背包 2021-01-05 15:56

I am getting below exception while running an application. This application read abc.properties file,

Exception in thread \"main\" java.util.MissingResourceExcept         


        
6条回答
  •  臣服心动
    2021-01-05 16:22

    Follow the hints in this post and see if you made one of those mistakes, which could be (copy pasted from the link):

    1. These resource properties files are loaded by classloader, similar to java classes. So you need to include them in your runtime classpath.

    2. These resources have fully-qualified-resource-name, similar to a fully-qualified-class-name, excerpt you can't import a resource into your java source file. Why? because its name takes the form of a string.

    3. ResourceBundle.getBundle("config") tells the classloader to load a resource named "config" with default package (that is, no package). It does NOT mean a resource in the current package that has the referencing class.

    4. ResourceBundle.getBundle("com.cheng.scrap.config") tells the classloader to load a resource named "config" with package "com.cheng.scrap." Its fully-qualified-resource-name is "com.cheng.scrap.config"

提交回复
热议问题