About the resourcebundle errors, I've read other questions about the same subject, but I didn't get any wiser. Tried different things, doesn't help. To give a little background: I developed a small app (JDK6), that does some flat file parsing and editing automatically. The app starts by reading some data from a properties file.
Important: I want to be able to change the properties file. I don't want to put it in the jar file.
However, even with the little example app that I tried creating, based on another questions/answer [here][1]:
package restestapp;
import java.util.Locale;
import java.util.ResourceBundle;
public class ResourceBundleTester
{
public static void main(String[] args)
{
Locale locale = Locale.getDefault();
String basename ="myresource";
ResourceBundle resourceBundle = ResourceBundle.getBundle(basename, locale);
System.out.println(resourceBundle.getString("STARTING_MYAPP"));
}
}
Both files are here:
/home/dakoina/Documents/ResTestapp/ResTestApp.jar
/home/dakoina/Documents/ResTestapp/myresource.properties
or even
c:/temp/ResTestApp.jar
c:/temp/myresource.properties
But when I run it, it gives me this output:
dakoina@ubuntu:~/Documents/ResTestapp$ java -cp /home/dakoina/Documents/ResTestapp/ -jar "ResTestApp.jar"
Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name myresource, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1539)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1278)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:805)
at restestapp.ResTestApp.main(ResTestApp.java:19)
and in Windows, the same...
c:\temp>java -jar ResTestApp.jar
Exception in thread "main" java.util.MissingResourceException: Can't find bundle
for base name myresource, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
at restestapp.ResTestApp.main(ResTestApp.java:19)
[1]: http://stackoverflow.com/questions/3742158/using-resourcebundle-with-an-external-file-java
I can't see where I am wrong :/