I’ve built a Java application which executes correctly from my IDE (Netbeans). I have packaged the jar into a bundle for Mac OS (Leopard). If I run the application from the bundle or from the shell I get this error:
java.lang.NoSuchMethodError: java.util.Properties.load(Ljava/io/Reader;)V
I’m using java 1.5.0_16.
Do you know why I get this error when I execute the jar using shell. Do you know why I don’t get it when I use IDE?
Thanks!
You’re using Java 5, but
Properties.load(Reader)was only introduced in Java 6 (aka 1.6). If this ever happens again, check the JavaDocs (e.g. thePropertiesJavaDoc in this case) and look at the member you’re interested in – it will often give the version in which it was introduced (e.g. ‘Since: 1.6’ in this case).You’ll need to create an
InputStreaminstead of aReader– or upgrade to Java 6. I suspect you’ll find NetBeans is using Java 6, which is why it’s working there.