0

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.access1ドル(URLClassLoader.java:211)
 at java.net.URLClassLoader1ドル.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.

PuTTY is using Java version '1.2.2'

How do you cange it to use a newer version of Java?

double-beep
5,68819 gold badges43 silver badges50 bronze badges
asked Jul 29, 2009 at 13:51
1
  • You need to talk to the administrator of the server you are working on in order to either get a newer java installed, or receive instructions about how to do it yourself. Commented Jul 29, 2009 at 17:02

6 Answers 6

3

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.

answered Jul 29, 2009 at 13:57
Sign up to request clarification or add additional context in comments.

Comments

1

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.

answered Jul 29, 2009 at 13:57

Comments

1

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.

answered Jul 29, 2009 at 13:58

Comments

0

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.

answered Jul 29, 2009 at 14:01

Comments

0

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.

answered Jul 29, 2009 at 14:01

Comments

0

I was having the same issue earlier when I was trying to use command

java -jar <jarfilename> --http <portname> --id <id name>

to run and demonstrate a DHT standalone projects. The issue is with the EC2 instances settings and it resides in JAVA version. So all you need to do is to update the version. I can't believe that there could be such difference in two close updates, but the command doesn't work in JAVA1.7 and hence I updated it to JAVA 1.8. Run these commands to do the following removing and installing new version

sudo yum install java-1.8.0

and then

sudo yum remove java-1.7.0-openjdk

Remember first install version 1.8 and then remove 1.7. And then i hope your issue would be resolved

answered Oct 28, 2018 at 15:17

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.