Resolving Java 8 problems
The Java Test Tool requires Java 8 to be installed to work correctly. A lot of people (including ourselves) have had trouble running the app, even after downloading and installing the latest Java 8 JDK.
Common problems
hfortier$ ./exampleapp Exception in thread "main" java.lang.UnsupportedClassVersionError: com/gambit/sdk/example/GambitExample : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
This means your Java version is out of date. Try running $ java -version
:
hfortier$ java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
Yup. You need 1.8.x
- Go to
System Preferences
- Click on
Java
- In the
Java Control Panel
, click on theUpdate
tab. - Make sure you have updated to 1.8.x, if you haven't do so now.
If you have updated to 1.8.x as per what is being reported by the Java Control Panel
, then see the appropriate section for your OS listed below:
OSX Trouble?
Please note that Apple / Oracle both don't play well and as a result, even "upgrading" your OSX Java version still will not affect which version of Java your terminal is running. Even after I updated to 1.8.x, my terminal still showed this:
hfortier$ java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
If you are completely positive that you have the latest Java installed as per prior instructions, then you should be able to run:
sudo rm /usr/bin/java sudo ln -s /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java /usr/bin
Which should fix the problem. This is because on OSX java is usually located in /usr/bin/java
. But the Oracle Java Updater installs it to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
So by fixing the symlink at /usr/bin/java
to point to the new version - problem solved!
hfortier$ java -version java version "1.8.0_73" Java(TM) SE Runtime Environment (build 1.8.0_73-b02) Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)
Windows problems?
After installing JDK 8 and running java -version
, it shows the correct version, but the app still throws exceptions on launch.
This is likely because your JAVA_HOME
environment variable is still pointed to the old version of Java.
- Right click My Computer and select Properties.
- On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:\Program Files\Java\jdk1.8.0_44.