views:

171

answers:

4

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

Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name abc, locale en_US
    at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:853)
    at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:822)
    at java.util.ResourceBundle.getBundle(ResourceBundle.java:566)
    at com.ibm.dst.DailyExtract.getResourceBundle(DailyExtract.java:104)
    at com.ibm.dst.DailyExtract.main(DailyExtract.java:131)

abc.properties file reside at the workspace. I am using RSA7 as IDE, is there any setting problem? any suggestions are welcome.....

Thanks a lot in advance

+2  A: 

Follow the hints in this post and see if you made one of those mistakes.

Alberto Zaccagni
A: 

Is the file in your classpath? If it is, try renaming it to abc_en_US.properties

fish
+1  A: 

Loading the Properties file for localization stuff is also affected by the package naming. If you put your Properties file in a package like org.example.com.foobar and load it just by its name abc you have to add the prefix org.example.com.foobar, too. If you have the properties at a different location (like in the root directory or in another subdir) you have to change either the name to load or the classpath.

I run fine in placing the properties file in the same location where the .java file is and using something like

private static ResourceBundle RES = ResourceBundle.getBundle(NameOfTheCurrentClass.class.getCanonicalName());
Progman
A: 

Thanks All for answering.... and special thanks to Montecristo. He provided very good link which actually help me.

Actually In property file I am using physical location and that location is not present physically. So I was getting the exception.

Thanks Crew

Maybe you should accept Montecristo's answer as the correct one then?
fish