Selenium WebDriver java.lang.UnsupportedClassVersionError: org/openqa/selenium/WebDriver : Unsupported major.minor version 52.0

23,309

Solution 1

The exception is generated from java.lang package, please take care of these observations. Because the java.lang.UnsupportedClassVersionError tells you this has nothing to do with selenium. That is probably why your question looks like duplicate and in risk of getting removed. You can check for a solution in the given possible duplicate link.

According to your given data, you have jdk8 and jre7 versions. You need to be having either jdk7-jre7 or jdk8-jre8 pair. If your code was compiled in a higher version jdk (8) and the .class files are being run in lower jre (7), this is to be expected.

So check your project settings from kushal's answer. or compile directly with a compatible/desirable jre version (from https://stackoverflow.com/a/11432195/2453382)

javac -target 1.7 Test.java

Solution 2

The code has been compiled with and for Java 8

You need to run with Java 8 too.

Solution 3

This error is probably because you are using Selenium 3.3.1 with Java 1.7 you need to upgrade java version to Java 1.8 OR it could mean that your java compiler setting doesn't match with your project settings, In that case you have to goto :

Project > Properties > Java Compiler > and select java version to the one you're using in your project as follow:

enter image description here

Share:
23,309
user
Author by

user

Updated on July 09, 2022

Comments

  • user
    user almost 2 years

    I have

    • Eclipse eclipse-jee-luna-SR2-win32-x86_64
    • Java - JRE7
    • jdk-8u121-windows-x64
    • Selenium Java Client Libraries - 3.3.1

    I am trying to get started with Started with Selenium, I wrote a simple program but I am getting error msg:

    "Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/selenium/WebDriver : Unsupported major.minor version 52.0"

    Below is the code:

    package com.automate;
    
    import java.io.File;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.chrome.ChromeDriver; 
    public class Test {
    
        public static void main(String[] args){
    
            System.setProperty("webdriver.chrome.driver", "C:\\Users\\swati\\Desktop\\Selenium\\chromedriver_win32_2.29\\chromedriver.exe");
            WebDriver driver = new ChromeDriver();
            driver.get("http://www.google.com");
        }
    }
    
  • matbrgz
    matbrgz about 7 years
    Downvote? Well, that is what that message means....