PLEASE HELP:MissingResourceException on ResourceBundle.getBundle in an Applet

D

Dan

Hello,

I am having the most difficult time trying to get
ResourceBundle.getBundle to work in an applet. It works great in my
testing environment, but my applet keeps throwing a
MissingResourceException. It is driving me crazy. The question is
simple, where do you place the *.properties files so that they are
accessible in the applet?

My code is as follows:
public grabResources() {
Locale currentLocale;
ResourceBundle messages;

currentLocale = Locale.getDefault();

messages = ResourceBundle.getBundle("resource", currentLocale);
System.out.println(messages.getString("test"));
}

I have tried :
messages = ResourceBundle.getBundle("package.resource",
currentLocale);

and neither work. I am using tomcat to serve the applet. I have
placed the properties files in every directory off my project path and
it still returns this exception. What is going on? What must I do in
order to utilize a properties file on an applet?

Please help
Dan
 
G

Guest

Hello,

I am having the most difficult time trying to get ResourceBundle.getBundle
to work in an applet. It works great in my testing environment, but my
applet keeps throwing a MissingResourceException. It is driving me crazy.
The question is simple, where do you place the *.properties files so that
they are accessible in the applet?

I would suggest including the resource bundles in the same jar as the
applet.

HTH,
La'ie Techie
 
D

Dan

L??ie Techie said:
I would suggest including the resource bundles in the same jar as the
applet.

HTH,
La'ie Techie


Hello La'ie,

In all honesty, I was under the impression that the jar file was being
created using the .properties files, however when I turn on verbose
and watch which files are being included, I don't see my properties
files anywhere. Is there something specific I need to do to include
these files into the jar? I am looking at the jar /? options, but
don't see anything promising.

In order to get around this problem, I wrote my own getBundle
functionality, however this deviates from the java standard quite
significantly and I would like to avoid this if possible. So, another
question would be is there a more standard way to make a getBundle
call where you can specify a path to the .properties file? One that
would utilize the parsing qualities of the ResourceBundle class? Of
course, this is very easy to write, but I would prefer to keep java's
prebuilt functionality.

Thanks for all your help.
Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top