1

I read through about 20 threads on this error and my issue is still not sorted and hence this question. Other thread which seemingly answer this question does not work in the following case or atleast, I don't know how.

My machine is Mac running Sierra. My java details are :

iMacRamesh:bin admin$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
iMacRamesh:bin admin$ java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

It is a servlet running on Tomcat 7. I compiled the program and am trying to run this when I get this error. My program uses a lot of third party libraries which are old. That said, my error is

java.lang.UnsupportedClassVersionError: eself/tool/servlet/Relevance : Unsupported major.minor version 51.0 (unable to load class eself.tool.servlet.Relevance)

The Relevance class is the new program that is definitely compiled on Java 7. That's all the Java I have, far as I can tell. From all the threads I have read, everyone suggests that such errors may be coming from when you are running a earlier version of java accessing a later version of the class file.

I would love to get someone to chime in on this.

  • And how do you start tomcat? – Strelok Dec 14 '16 at 07:22
  • My build is done using ant. I build jar files and deploy it. Ant version 1.9.7 – Ramesh Ramasubramanian Dec 14 '16 at 07:24
  • Sorry I actually edited the question. How do you start tomcat? What's the output of `curl http://tomcat:password@localhost:8080/manager/text/serverinfo` – Strelok Dec 14 '16 at 07:25
  • Possible duplicate of [How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version](http://stackoverflow.com/questions/10382929/how-to-fix-java-lang-unsupportedclassversionerror-unsupported-major-minor-versi) – Emily Mabrey Dec 14 '16 at 07:26
  • I start Tomcat from a shell. Would you like me to paste the script here? Curl output is huge and seems to give me security error. Tomcat starts fine and the manager page seems fine and so are the examples. The following is the output on my terminal; `start_tomcat Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /System/Library/Frameworks/JavaVM.framework/Home Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar` – Ramesh Ramasubramanian Dec 14 '16 at 07:33
  • @Strelok, I added JAVA_HOME to my run.sh to '/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home' and the error went away. Thanks for your comment on tomcat startup. – Ramesh Ramasubramanian Dec 14 '16 at 07:52

0 Answers0