• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ResourceBundle-Can't find bundle for base name

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic