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

这一生的挚爱 提交于 2019-12-04 02:26:29

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)

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.

Steven Baldasty

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.

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.

Ganesh Kodali

I faced similar problem. Just install Nodejs, Protractor and JDK with latest versions. It works without any issues.

Initially I faced issue with JRE version mismatch.

I have Selenium web driver 3.0 and Jre 1.7. I uninstalled all and installed with latest versions.

Isha Saxena

Install the latest version of java i.e. 12 using

brew cask install java

Uninstall the one downloaded from Oracle following https://www.java.com/en/download/help/mac_uninstall_java.xml

Might help a great deal!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!