Unable to run selenium standalone server

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?

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.


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


A colleague of mine tried to use selenium-java-2.48.2.jar where he got the same error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/grid/selenium/GridLauncher : Unsupported major.minor version 51.0 ```

I sent him an old version selenium-java-2.44.0.jar and now it works in his environment just fine.


Need Your Help

How to get a status of a running query in postgresql database

postgresql postgresql-8.4

I have a select query running very long. How will I get a status of that query, like how long will it be running? Whether it is accessing a data from the tables or not.