I'm getting following error, while i'm running code in windows xp service pack 3 with JDK 6 version.

0 votes
i'm getting following error, while i'm running code in windows xp service pack 3 with JDK 6 version.  I'm not able to install JDK 8.

pls help me

java.lang.UnsupportedClassVersionError: org/openqa/selenium/WebDriver : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Exception in thread "main"
May 16, 2018 in Java by vamshi
186 views

2 answers to this question.

0 votes
Hey! I want you to share the code that you are trying to execute so that I can understand the issue more clearly.
answered May 16, 2018 by Meci Matt
• 9,400 points

edited May 16, 2018 by Meci Matt
package vamshi.tutorial;

import java.util.concurrent.TimeUnit;


import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;


public class Day1 {
    WebDriver driver;
   
    public void invokeBrowser(){
        try {
            System.setProperty("webdriver.chrome.driver","F:\\chromedriver_win32 (1)\\chromedriver.exe");
            driver = new ChromeDriver();
            driver.manage().deleteAllCookies();
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
           
           
            driver.get("https://www.facebook.com/");
        } catch (Exception e) {
           
            e.printStackTrace();
        }   
    }

    public static void main(String[] args) {
     
     Day1 myObj = new Day1();
     myObj.invokeBrowser();
    }

}
0 votes

Till you send the code, I would tell you what the problem is according to me.

Actually, java.lang.UnsupportedClassVersionError happens because of a higher JDK during compile time and lower JDK during runtime.

Don't worry, It is actually simple. What you need to do is, you need to first uninstall the JRE/JDK that you have (also the IDE) and then install BOTH JRE / JDK of the same version, like:
JRE 6 -> JDK 6
JRE 7 -> JDK 7

Hope this will solve your problem, If not do share the code.

answered May 16, 2018 by Meci Matt
• 9,400 points
package vamshi.tutorial;

import java.util.concurrent.TimeUnit;


import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;


public class Day1 {
    WebDriver driver;
   
    public void invokeBrowser(){
        try {
            System.setProperty("webdriver.chrome.driver","F:\\chromedriver_win32 (1)\\chromedriver.exe");
            driver = new ChromeDriver();
            driver.manage().deleteAllCookies();
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
           
           
            driver.get("https://www.facebook.com/");
        } catch (Exception e) {
           
            e.printStackTrace();
        }   
    }

    public static void main(String[] args) {
     
     Day1 myObj = new Day1();
     myObj.invokeBrowser();
    }

}
Above is the code.

So do i need to install JRE6 and JDK 7?
----------------------------------------------------------------------------------------------------------------------------
After installing JDK7 and JRE6.  Still Below error is displaying pls check.

java.lang.UnsupportedClassVersionError: org/openqa/selenium/WebDriver : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    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)
Exception in thread "main"

Related Questions In Java

0 votes
1 answer

Following error is occurring "Can't start Eclipse - Java was started but returned exit code=13"

There are combinations of Operating System, JDK ...READ MORE

answered Apr 19, 2018 in Java by Rishabh
• 3,540 points
738 views
0 votes
1 answer

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK

In your Eclipse IDE, go into Window > Preferences > Java > Installed JREs > ...READ MORE

answered Jun 18, 2018 in Java by parth295
• 4,600 points
590 views
0 votes
1 answer

Getting error 404 not found when trying to download JDK

Try this command, it should work: wget --no-check-certificate ...READ MORE

answered Dec 26, 2018 in Java by Omkar
• 67,290 points
244 views
0 votes
1 answer

Getting "Unsupported major.minor version" error.

I will recommend not to upgrade the ...READ MORE

answered Feb 21 in Java by Sapan
58 views
+5 votes
3 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,380 points

edited Nov 6, 2018 by Omkar 7,103 views
0 votes
2 answers
0 votes
1 answer

How does omitting curly braces in Java program, effect the code ?

Using braces makes the code more maintainable ...READ MORE

answered May 14, 2018 in Java by Rishabh
• 3,540 points
35 views
0 votes
1 answer

How to run the JAR files in windows?

Following are the steps to run the ...READ MORE

answered May 28, 2018 in Java by parth295
• 4,600 points
69 views
0 votes
1 answer

How to pad an integer with zeros on the left in Java?

Use java.lang.String.format() method. String.format("%05d", number) ...READ MORE

answered May 31, 2018 in Java by Daisy
• 8,040 points
103 views