1

I know this question was asked so many times but I never found an answer that relates to my question. I am trying to install Apache Tomcat server on my MacBook Pro. All answers were answered for Windows and Eclipse. I want to install and configure the server using Terminal. So the problem is happening at the last step of the installation. I am getting the below error while installing the server. I know this is a problem is about Java version at run time, but I can't fix it. Note: I have already updated my Java version to the latest one. Please help.

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/catalina/startup/Bootstrap : 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)
    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)
Community
  • 1
  • 1
Jack
  • 258
  • 2
  • 7
  • 15

2 Answers2

4

You say you've got the latest version, but then you also say you're using Java 1.6_051. That is not the latest version of Java.

You need Java 7 - see this page for how to install Java 7 on Mac OSX.

If you can't install Java 7 on your machine for some reason, you'll need to use a different version of Tomcat. Tomcat 8 requires Java 7, as shown on the "which version" Tomcat page. You might also wish to consider using an older version of Tomcat anyway, given that Tomcat 8.0 is still only at RC-1 level - I would typically stick with a stable version unless you're willing to take on the pain of pre-releases.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • I know it shows Java 7 when I view it in the System Preferences. But when I view it in terminal using java -version is shows the mentioned version – Jack Aug 24 '13 at 07:38
  • @Jack: Well that sounds like you need to change your path to pick up Java 7 from the terminal. – Jon Skeet Aug 24 '13 at 07:39
  • That's the problem is what I can't figure our, Jon. Please advise how can I do so. Thanks – Jack Aug 24 '13 at 07:42
  • please see this reference http://stackoverflow.com/questions/6588390/where-is-java-home-on-osx-lion-10-7-or-mountain-lion-10-8 – Prabhakaran Ramaswamy Aug 24 '13 at 07:51
  • Awesome Jon. I just installed Apache Tomecat version 7 and it worked!! thanks! – Jack Aug 24 '13 at 07:53
-1

For Tomcat 8 Any installed Java 7 or later JRE (32-bit or 64-bit) may be used.

Please read the requirements

http://tomcat.apache.org/tomcat-8.0-doc/setup.html

Prabhakaran Ramaswamy
  • 25,706
  • 10
  • 57
  • 64
  • I actually did and I mentioned that I did the update for the latest version for Java. Please read what I have said before answering questions. Thanks – Jack Aug 24 '13 at 07:54