Bowersbros Bowersbros - 4 months ago 19
Java Question

Unsupported major.minor version on Mac OS X El Capitan

Following the solutions online for Major Minor version of Java being incorrect on El Capitan, I saw several solutions which made you either disable rootless, which i didn't like the sound of, or just didn't work anymore in OS X El Capitan.


When trying to run webdriver-manager start on El Capitan, you may get an error saying:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/grid/selenium/GridLauncher : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(
    at java.lang.ClassLoader.defineClass(
    at Method)
    at java.lang.ClassLoader.loadClass(
    at sun.misc.Launcher$AppClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
Selenium Standalone has exited with code 1

The recommended fix for this online is to change the symlink that Mac OS X has to Java, which you can find by running echo $JAVA_HOME in the terminal.

This is pointing to the incorrect folder, and the error is because the application was compiled with a higher version of JRE than the machine is running in the terminal.

You should go to Oracle, and download the latest JRE version (

After this has been installed, you will have Java 8 on your machine, but it will not update the terminal properly. If you run java -version in your terminal, you'll see Java Version "1.6", you want this to say Java Version "1.8". The previous way to do this was to change the symlink manually, however, since El Capitan, Apple have made certain folders unchangable even to admin users, with their Rootless install. This includes the /usr folder.

There are two ways to fix this, the first is dangerous, and what everyone else seems to recommend. The second, is safer, and what I am putting here.

If you go to your System Preferences -> Java -> Java -> View... -> System and copy the Path field.

It will look something similar to the following:

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java

We want most of this path, except the /bin/java on the end.

So your path should now be copied as:

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

Run the following command in the terminal, replacing [PATH] with the path you have from above.

export JAVA_HOME="[PATH]"

and run that in the terminal.

Afterwards, run java -version again, and it should now say Java Version "1.8"

Now, webdriver-manager start should succeed.