Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.UnsupportedClassVersionError: org/openqa/gr id/selenium/GridLauncher (Unsupported major.minor version 50.0)

I got this selenium server jar file in my Selenium folder. When I'm trying to execute this with java - jar selenium-server-standalone-2.0b3.jar command I'm getting this version difference error. Can anyone please show me where I'm making a mistake?

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/gr
id/selenium/GridLauncher (Unsupported major.minor version 50.0)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
like image 963
sam1132 Avatar asked Jul 18 '12 00:07

sam1132


4 Answers

That message (with version 50.0) indicates that Selenium server requires java 6 to run, but you're trying to run it with some earlier version of java.

To find out what version of java you're using, run:

java -version

If you have java 6 installed, but it isn't getting used, you may have to give the full path name to the java executable, so something like this if on linux:

/usr/local/jre6/bin/java -jar selenium.jar

or like this if on windows:

"C:\Program Files (x86)\Java\jre6\bin\java.exe" -jar selenium.jar

(Of course, you'll need to adjust that command to match where java actually lives on your machine)

like image 168
Daniel Martin Avatar answered Nov 15 '22 17:11

Daniel Martin


I had the same problem, I was using jre6, I went to the project properties, changed the JRE system library to use jre1.8 and it worked.. you can select alternate jre and add the latest jre installed on your system.

like image 36
Himayath Avatar answered Nov 15 '22 17:11

Himayath


Besides the Java version, the Java vendor can apparently be another important variable. I landed on this thread with a variation of the OP's problem where the stack trace indicated that Java 8 was required, even though I was already using OpenJDK 8.

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/grid/selenium/GridLauncherV3 : 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)

Switching to Oracle's JVM got me past this.

like image 20
Steven Baldasty Avatar answered Nov 15 '22 18:11

Steven Baldasty


In my case when I did 'java -version' I got this:

Picked up _JAVA_OPTIONS: -Duser.home=C:\Users\xxxx
java version "1.7.0_151"
Java(TM) SE Runtime Environment (build 1.7.0_151-b33)
Java HotSpot(TM) Client VM (build 24.151-b33, mixed mode)

and my 'JAVA_HOME' was different as mentioned below:

C:\Program Files\Java\jdk1.8.0_91

So I have just added 'jdk1.8.0_91' in the path under my Environment Variables like this:

BEFORE:

C:\Program Files (x86)\Java\jre7\bin;

AFTER:

C:\Program Files\Java\jdk1.8.0_91\jre\bin; C:\Program Files (x86)\Java\jre7\bin;

And after that I was able to run 'webdriver-manager' successfully. I hope this will helpful for others.

like image 43
tutorialfeed Avatar answered Nov 15 '22 16:11

tutorialfeed