Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat Issue: Unsupported major.minor version 52.0 [duplicate]

I am a newbie, so you might have to simplify explanation for me. On my command line it says tomcat started. But when I try to go to my browser and type 'Http://localhost:8080' it says failed to open page.

In the Tomcat log I got this error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/catalina/startup/Bootstrap : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

FYI

java version "1.8.0_60"

Java(TM) SE Runtime Environment (build 1.8.0_60-b27)

Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

I have download the latest tomcat version. I am using NetBeans

I have two netbeans one was standard edition that I added the EE plugin (don't know if this has any relevance), the other netbean is download as the EE. Why because I don't know what I am doing and mac doesn't allow me to delete and I don't want to use the command line to this because again I don't know what I am doing.

I have been spending a lot of time on this and I am assuming it has something to do with either JAVA_HOME or the version of the JDK. If that is the case please I need instruction on how to do this. I have been trying to instal maven and tomcat for 2 days now.

**This might help also when I try to run a project on netbeans it says:

NetBeans: No suitable Deployment Server is defined for the project or globally.

Things I have don't but don't know why: Inside my catalina.sh I have written this:

#!/bin/sh JAVA_HOME=/usr/local/apache-tomcat-9.0.0.M1/bin

On my command line LASTLY I have written this:

timurs-MacBook-Air:~ timur$ export PATH=$JAVA_HOME/bin:$PATH

This is tomcat Version info:

timurs-MacBook-Air:~ timur$ /usr/local/apache-tomcat-9.0.0.M1/bin/catalina.sh version
Using CATALINA_BASE:   /usr/local/apache-tomcat-9.0.0.M1
Using CATALINA_HOME:   /usr/local/apache-tomcat-9.0.0.M1
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-9.0.0.M1/temp
Using JRE_HOME:        /Library/Java/Home
Using CLASSPATH:       /usr/local/apache-tomcat-

9.0.0.M1/bin/bootstrap.jar:/usr/local/apache
-tomcat-9.0.0.M1/bin/tomcat-juli.jar
like image 942
0xtimur Avatar asked Dec 18 '15 22:12

0xtimur


1 Answers

  • java.lang.UnsupportedClassVersionError happens because of a higher
    JDK during compile time and lower JDK during runtime.

  • If you are using eclipse do the following go to menu command Window -> Preferences -> Java -> Compiler and then set "Compiler compliance level" to 1.8

  • Make sure JRE_HOME is set to 1.8
like image 135
Ritesh Karwa Avatar answered Sep 20 '22 14:09

Ritesh Karwa