I’m trying to run tomcat 7 on my mac and when I try to start tomcat it just exits after printing the value of env variables it is using. So I ran configtest.sh which gave me the following error msg:
Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad version number in .class file
After doing some search I found that this error occurs when tomcat is using jdk < 1.6 so I looked at the JRE_HOME that tomcat is using when it tries to startup which is
Using JRE_HOME: /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
which in turn is a symlink to /System/Library/Frameworks/JavaVM.framework/Versions/1.5 and not to 1.6. I used the “Java Preferences” to use Java SE 6 but still it is not working.
I can manually update the ../CurrentJDK/Home to 1.6 but I was wondering how did tomcat pick up JRE_HOME as /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home and is there a setting that I need to update to use Java 1.6 instead on 1.5.
Thanks
Apple’s Java FAQ should answer everything you need.
In short, yes, you can change the system JDK via the Java Preferences, in the System Preferences. Can also be found by typing “Java” into Spotlight.