I have an application that needs to be deployed in JBoss 6.0.0 and I am using Eclipse Mars. My system variable points to Java 1.6, from build path I've selected Java 1.6 and also, JBoss is using Java 1.6. My problem is that when trying to deploy the app to JBoss the following error
[org.jboss.detailed.classloader.ClassLoaderManager] Unexpected error during load of:com.xservice.java.velocity.VelocityLoader: java.lang.UnsupportedClassVersionError: com/xservice/java/velocity/VelocityLoader : Unsupported major.minor version 52.0.
I don't have any idea how to handle this considering the given settings.
The problem was fixed by changing the Java version from Project Facets(it was 1.8 instead of 1.6). Thanks go to Sanjeev Saha.
Project facets screen
Please locate the Jar which contains the class com.xservice.java.velocity.VelocityLoader.
This class is compiled with JDK 8. The class file version for Java SE 8 is 52.0 as per http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html Your JVM is Java 6. You may not be able to run a Java class compiled with JDK 8.0 by JVM 6.0. This is the reason you are getting 'Unsupported major.minor version 52.0'
My suggestion is using a Jar which contains classes compiled by JDK 6.0.
Related
I have two applications one is written in Java and the other is written in Scala.
The java application is using the Scala application as a library. When I build the java application against JDK 1.8 every thing works fine.
When I build the application against JDK 1.7, the application throw the following exception.
java.lang.UnsupportedClassVersionError: scala/collection/Seq :
Unsupported major.minor version 52.0
It seems that the Scala application is only compatible with JDK 1.8.
I tried to change the project compiler settings in the Scala project and set the target JVM into version 1.7 but nothing changed.
Any suggestions to have the application run against JDK 1.7 ?
I'm deploying Jasig CAS 4.0.0 using Maven Overlay Installation.
I created my custom classes and when deploying it I get this error in the cas.log:
Unsupported major.minor version 52.0 (unable to load class ...)
Environment specs
OS: Debian 7
Web server: Apache tomcat 7.0.28
Java: Oracle 8,
Java & Javac version: 1.8.0_40,
Java home: /usr/lib/jvm/java-8-oracle/jre,
Maven:v 3.0.4,
Eclipse Luna,
Maven POM
maven-compiler-plugin: 3.2
maven.compiler.source: 1.8
maven.compiler.target: 1.8
Any help is appreciated.
Your runtime must not be using Java 8 (even if you believe it does). Dbl check the one used by tomcat: if you have tomcat manager installed you can use its web page to check it, if not add echo to catalin.sh to check java version used.
Typically in linux you jave more than one Java SDK installed, with java being a link to the most recent one. But tomcat can have its own path to JavaSDK set using JAVA_HOME.
I am trying to deploy my JSP and java files on the server. But when I try to access the jsp I get the error msg
javax.servlet.ServletException: java.lang.UnsupportedClassVersionError: com/usct/db/DBConnect : Unsupported major.minor version 51.0
I read a few posts and found out that this is due to difference in Java version on the two different platforms but I am using JAVA 1.7 on my server and my client when I do
java -version
in my jdk/bin it shows that the java version is 1.7.0_10 and
Java SE Runtime Environment (build 1.7.0_10-b18)
Can someone please help me with this issue?
Thank you
... but I am using JAVA 1.7 on my server and my client when I do ...
The most likely explanation is that you are actually using Java 1.6 or earlier ... despite what you think. In other words, when you run java -version from the command-line, you are getting a different Java installation to the one that is being used to run your web container.
(If you are on a Linux system, you should be able to tell which JVM is being used by running ps -efl and greping for "java" or similar. Alternatively, use the approach suggested by #dbf.)
It is worth noting that the version of Java on the client is not relevant. The exception is occurring on the server side.
Reference: How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
- explains the general problem and solution.
java.lang.UnsupportedClassVersionError error occurs due to higher JDK during compile time and lower JDK during runtime.
Java Version Major Version
Java 4 48.0
Java 5 49.0
Java 6 50.0
Java 7 51.0
So if you compile your Java source file with javac of JDK 1.7 it will
create class files with major version 51.0 and if you run those class
files with Java 1.6 it will throw
java.lang.unsupportedclassversionerror unsupported major.minor version
51.0 error
Try Compiling with older JDK or Upgrade the JRE.
More more information visit.
I believe com/usct/db/DBConnect is not a class provided by Java. And hence the reason of your error is not the version of jdk and jre on both your coding and execution environment. It seems the jar you used for the class DBConnect on your client and environment are of different java versions.
Try to print System.getProperty("java.version") from your JSP to check what version is actually used by your server.
I am getting a Unsupported major.minor version 51.0 error after moving from IntelliJ IDEA JBoss to MyEclipse Tomcat.
Everything was working great under IntelliJ IDEA and JBoss and now we are moving to MyEclipse and Tomcat 6..
I am getting:
Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141
can someone please tell me how to fix this issue
This happens when you compile the code in a higher version of the JDK than you are using at runtime.
You can set the compiler version here:
Project -> Properties -> Java Compiler
It seems that the version of JRE under tomcat is newer than the one used to compile the code.
To fix the actual problem you should try to either update your JRE pointing in Tomcat with newer version Java JRE or specify target parameter to the Java compiler to instruct the compiler to create code compatible with earlier Java versions in Eclipse.
If you did all kind of thing and it didn't work,
maybe you need to delete target in your project,
because I found if I builded them again and it would be very fast to compelete, then I relized I used old result of complier.
enter image description here
I just started off with Google App Engine 1.6.4 in Eclipse Indigo a couple of days ago and I face a problem with the back end.
Whenever I try to use a servlet or a JSP, I get this annoying
java.lang.UnsupportedClassVersionError: org/msamogh/MyServlet : Unsupported major.minor version 51.0
I tried changing my JRE to Java 6, but the error still remains. Does anyone know how to fix this.
The major.minor version 51.0 seems to indicate that your classes are compiled using Java 7. Please make sure that the following are done:
Start Eclipse using a Java 6 JDK.
Set the default JVM in Eclipse to a Java 6 JDK.
Set the default and/or project compiler settings to use 1.6 target.
In general, you need to make sure that your runtime JRE is able to understand your compiled code. If you try to run code compiled for 1.7 on a 1.6 JRE, you will get the above error.
What is your output when you do java -version? This will tell you what version the running JVM is.
The Unsupported major.minor version 51.0 error could mean:
app is running on a lower Java version then the one used to compile it
Try adding a SYSTEM VARIABLE that looks like this: JRE_HOME = C:\PROGRAM FILES\JAVA\JRE7 or JRE6 shipped with the JDK 1.7 or later package with which you compiled it.