File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes ResourceBundle-Can't find bundle for base name  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "ResourceBundle-Can Watch "ResourceBundle-Can New topic

ResourceBundle-Can't find bundle for base name

Deepali Kaul

Joined: Apr 17, 2007
Posts: 1

I am developing a multilingual application on tomcat 4.1 + WSAD 5.1.1.

I am using a class file for fetching the labels by setting the locale.

here's the method that i'm using:

public String getLabel(String str_lang,String str_cn,String int_lang_id)throws java.util.MissingResourceException
String msg= null;

//this local variable is for getting the language string from file
Strings_lang = null;

//this local variable is for getting the country string from file
Strings_cn = null;

if (str_lang==null) {
s_lang=new String("en");
s_cn=new String("JP");

} else {
s_lang=new String(str_lang);
s_cn=new String(str_cn);

Locale currentLocale = new Locale(s_lang, s_cn);
ResourceBundle messages = ResourceBundle.getBundle("GHDS",currentLocale);
msg = messages.getString(int_lang_id).trim();
} //end of try
catch(Exception se)
System.out.println("File could not be Found--->"+se);
return msg; //RETURNS THE LABEL
}//end of function

The name of my properties file is

I'm getting a run time error that says "File could not be Found--->java.util.MissingResourceException: Can't find bundle for base name GHDS, locale en_JP"

could you kindly help me out on this.
Scott Escue
Ranch Hand

Joined: Jan 20, 2005
Posts: 34

Where is located? Your code looks correct to me, assuming your properties file is in stored in the root of your classpath, meaning it should be located directly within your source folder.
I agree. Here's the link:
subject: ResourceBundle-Can't find bundle for base name
It's not a secret anymore!