tags:

views:

91

answers:

5

I am trying to run some java code using putty. I have all the jar files I need in a folder and when in the folder with the 'classname.class' folder I try to run the file but I get the following error.

Exception in thread "main" java.lang.UnsupportedClassVersionError: dueDate (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:489) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:104) at java.net.URLClassLoader.defineClass(URLClassLoader.java:245) at java.net.URLClassLoader.access$1(URLClassLoader.java:211) at java.net.URLClassLoader$1.run(URLClassLoader.java:192) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:186) at java.lang.ClassLoader.loadClass(ClassLoader.java:294) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:290) at java.lang.ClassLoader.loadClass(ClassLoader.java:250) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)

I don't know what this error means and how I should go about fixing it. I used eclipse to program it and 'jdk-6u14'. Any help would be much appreciated.


Putty is using java version '1.2.2'


Thanks for the answers. How do you cange it to use a newer version of Java?

+1  A: 

You're trying to run new java code on a really old JDK - 1.2.2

Eclipse might provide some backwards-compilation options (check your project -> preferences -> java compiler), though I think it only goes back to 1.3.

Therefore you might want to try using a newer JDK to actually run the code.

+3  A: 

Well it's not really PuTTY that's using Java. It's the server you're connecting to. PuTTY is just what you're using to conenct to that server.

You have two options:

  • Change the target version of Java (Windows/Preferences/Java/Compiler/Compiler Compliance Level) to 1.3... ideally you should compile against a 1.2.2 JDK as well, in order to avoid using any classes which won't be present on the server.
  • Get hold of a more up-to-date version of Java on the server.

The latter is likely to be harder but much better. You really don't want to have to restrict yourself to Java 1.2.2.

Jon Skeet
+1  A: 

The error suggests that you are trying to run classes on a JVM that does not support them. The class version 49.0 was introduced in Java 5. JREs before that version will not support them.

McDowell
A: 

UnsupportedClassVersion means the compiled class was compiled with a later version of the JVM than you're trying to run it with. The last few major versions are java 1.6==50.0, java1.5==49.0, java1.4==48.0.

BTW, you can set eclipse to compile an earlier version of the class, although I'm not sure you can go back as far as 1.22- Project:Properties:Compiler:CompilerComplianceLevel.

Steve B.
A: 

It basically means you are trying to run code that is using features that are not supported on that version of the JVM. Your server has an older JVM version than what you are using in your eclipse. Try upgrading your server JVM to the most up to date version possible.

Carlos