I had developed a Project in Eclipse in Windows. I have created the jar file and i have uploaded it in a Unix machine using Filezilla. Now when i run the jar on the Unix machine, I get an error message as:
Could you please tell me the how to get rid of this problem! I have JAVA 1.6 installed on my windows machine and the java installed in the Unix box is 1.4.
The error message means that you have compiled your classes with JDK version 6, but that you are trying to run the classes on an older JRE (Java 5 or older).
Java is downwards compatible - classes compiled with an older version run unmodified on a newer version, but not upwards compatible - classes compiled with a newer version do not run on an older version.
Make sure you compile your source code with the right JDK version. JDK 1.4 is still available for download on Sun's website.
You could use the -source and -target switches as Rob suggests, but if you use classes from the Java 6 standard API which don't exist in the older JRE, it will still not work correctly.
The source and target must be set when compiling, not when running the JVM. So it's "javac -source 1.4 -target 1.4 <anything else you want>". If you're using an IDE like Eclipse you can specify the target platform in the project properties.
Joined: Mar 04, 2009
Thanks everyone. I changed the compiler to 1.5 in Eclipse and created the jar again! Now its working!
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com