File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ResourceBundle-Can't find bundle for base name

 
Deepali Kaul
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Scott Escue
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic