Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to run selenium standalone server

Tags:

java

selenium

I am trying to run selenium-standalone-server 2.47.1.jar through command prompt.

But I am facing this error.

C:\automation\node_modules\selenium-webdriver>java -jar selenium-server-standalo
ne-2.47.1.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/gr
id/selenium/GridLauncher : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(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$000(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)
Could not find the main class: org.openqa.grid.selenium.GridLauncher. Program wi
ll exit.

C:\automation\node_modules\selenium-webdriver>

Why am I getting this error?

I have JDK installed already(since I need to run netbeans).

Is there anything I am missing?

like image 548
Smruti Singh Avatar asked Aug 29 '15 04:08

Smruti Singh


People also ask

How do I know if Selenium standalone server is installed?

Or You can also check with http://localhost:4444/selenium-server/driver/?cmd=getLogMessages If serveris runnning then it will show 'ok' in browser.

Do I need Selenium standalone server?

If you will be only using the WebDriver API you do not need the Selenium-Server. If your browser and tests will all run on the same machine, and your tests only use the WebDriver API, then you do not need to run the Selenium-Server; WebDriver will run the browser directly.


2 Answers

java.lang.UnsupportedClassVersionError happens because the code was compiled with a higher version of Java than the one you're running it.

Version 51.0 of a class file corresponds to java 7

J2SE 8 = 52,
J2SE 7 = 51,
J2SE 6.0 = 50,
J2SE 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45

You need to upgrade your JDK from Java 6 to Java 7 or higher.

like image 180
Esteban Herrera Avatar answered Oct 13 '22 12:10

Esteban Herrera


Just download the last JDK from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

It helps me resolve the problem on my mac the problem was Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/grid/selenium/GridLauncher : Unsupported major.minor version 51.0

resolved by download and install Mac OS X x64 196.89 MB jdk-7u79-macosx-x64.dmg

like image 6
Володимир Кузьменко Avatar answered Oct 13 '22 12:10

Володимир Кузьменко