Here is my problem:-
I have a java program packaged into a jar file. There is also a properties file I wish to distribute with the jar file (but not in the jar file). When I run the program it cannot find the resourcebundle. I get the error :-
Caused by: java.util.MissingResourceException: Can't find bundle for base name c
om.das.comp.stuff.messages, locale en_GB
The jar file is in a directory on my local machine (say c:\whatever) and I am running the jar file from within that directory. Where should I put the properties file so it can be found?? I have pointed the classpath(in the manifest file) to include the C:\whatever directory and the .jar file itself and it still does not work.
(It will work with the properties file in the jar file but that is what I want to avoid.)
Any help greatly appreciated!
Therefore your class path must contain the path to the directory in which the properties file reside.
Another simpler option could be to use PropertyResourceBundle instead of just ResourceBundle. Because PropertyResourceBundle accepts an InputStream as parameter, and if your know that your properties file will reside in the same directory of the jar file you could very easily obtain an InputStream from it and pass it to the PropertyResouceBundle.
This way the properties file would never be looked up wihtin the jar, but in a local directory.
At the end the result is the same, since ResouceBundle.getBundle() actually creates a PropertyResouceBundle behind the scenes.
Originally posted by Darren Briaris:
I originally had this logged in the beginners forum but the ideas have dried up there so I thought I would try here. I hope this is not againist the rules but only my second post so if it is i apologise in advance.
If you do do this, it's nice if you put a note in the original thread. That way you won't get the same conversation going on in two threads. As you're new, I've done this for you this time
[ July 21, 2006: Message edited by: Joanne Neal ]