This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "ResourceBundle-Can Watch "ResourceBundle-Can New topic
Author

ResourceBundle-Can't find bundle for base name

Deepali Kaul
Greenhorn

Joined: Apr 17, 2007
Posts: 1
Hi!

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;
try
{

//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);
System.out.println("BEFORE");
msg = messages.getString(int_lang_id).trim();
System.out.println("msg"+msg);
} //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 GHDS_en_JP.properties

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
Deepali,

Where is GHDS_en_JP.properties 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.
 
Don't get me started about those stupid light bulbs.
 
subject: ResourceBundle-Can't find bundle for base name
 
Similar Threads
Problem with ResourceBundle and Weblogic
getting Properties file in MessageBundle
Internationalization
Help with I18N
ResourceBundle file name problem