java.lang.unsupportedclassversionerror spring boot
has been compiled by a more recent version of the java runtime
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
PuTTY is using Java version '1.2.2'
How do you cange it to use a newer version of Java?
How to fix java.lang.UnsupportedClassVersionError , The version number shown describes the version of the JRE the class file is compatible with. The reported major numbers are: Java SE 14 = 58 Serializable public class UnsupportedClassVersionError extends ClassFormatError Thrown when the Java Virtual Machine attempts to read a class file and determines that the major and minor version numbers in the file are not supported.
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.
How to resolve java.lang.UnsupportedClassVersionError with example, Java.lang.UnsupportedClassVersionError is a subclass of java.lang.ClassFormatError. This is a kind of linking error which occurs during linking public class UnsupportedClassVersionError extends ClassFormatError Thrown when the Java Virtual Machine attempts to read a class file and determines that the major and minor version numbers in the file are not supported.
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.
UnsupportedClassVersionError (Java Platform SE 7 ), public class UnsupportedClassVersionError extends ClassFormatError. Thrown when the Java Virtual Machine attempts to read a class file and determines that How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version -1 Equal JDK, but still “has been compiled by a more recent version of the Java Runtime”
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.
java.lang.unsupportedclassversionerror, The UnsupportedClassVersionError indicates that the current JVM does not support your application's class file. To begin with, we must UnsupportedClassVersionError is an error, so we can’t do anything about it from application point of view to recover from it. java.lang.UnsupportedClassVersionError is a runtime error, it doesn’t come at compile time. Every java class contains a major.minor version number, this number denotes the java compiler version.
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.
Java Exception Handling - UnsupportedClassVersionError, As previously mentioned, an UnsupportedClassVersionError is thrown when the JVM attempts to use a class that was compiled using an Java.lang.UnsupportedClassVersionError is a subclass of java.lang.ClassFormatError. This is a kind of linking error which occurs during linking phase accordingly java.lang.ClassFormatError has also derived from java.lang.LinkageError.
How to fix java.lang.UnsupportedClassVersionError, UnsupportedClassVersionError: Unsupported major.minor version, It happens when you compile your projects on higher version of java(e.g. jdk 1.8) and then Unsupported major.minor version 52.0 comes when you are trying to run a class compiled using Java 1.8 compiler into a lower JRE version e.g. JRE 1.7 or JRE 1.6. Simplest way to fix this error is install the latest Java release i.e. Java 8 and run your program.
java.lang.UnsupportedClassVersionError, java.lang.UnsupportedClassVersionError is one of the runtime error and thrown when a class is compiled by a more recent version that the
How to fix java.lang.UnsupportedClassVersionError , To fix this problem you should try running the code with a new version of JAVA JRE or you can specify the target parameter to JAVA compiler,
- 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.