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
2,735 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,460 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,460 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,620 points
3,013 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 Parth
• 4,640 points
3,391 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
• 69,220 points
3,363 views
0 votes
1 answer

Getting "Unsupported major.minor version" error.

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

answered Feb 22, 2019 in Java by Sapan
1,529 views
0 votes
1 answer
+1 vote
1 answer
0 votes
0 answers

Why does my JavaScript code receive a "No 'Access-Control-Allow-Origin' header is present on the requested resource" error, while Postman does not?

I'm attempting to provide authorisation using JavaScript by connecting to the RESTful API integrated into Flask.  However, when I make the request, I receive the following error: XMLHttpRequest cannot load http://myApiUrl/login. No 'Access-Control-Allow-Origin' header ...READ MORE

Sep 20, 2022 in Java by Nicholas
• 7,760 points
564 views
0 votes
2 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP