java.lang.UnsupportedClassVersionError: Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1

java.lang.UnsupportedClassVersionError: com/xtr/parallel/QuickTestWinFF :Unsupported major.minor version 51.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) at
 org.testng.internal.ClassHelper.forName(ClassHelper.java:96) at
 org.testng.xml.XmlClass.loadClass(XmlClass.java:78) at org.testng.xml.XmlClass.init(XmlClass.java:73) at
 org.testng.xml.XmlClass.(XmlClass.java:59) at
 org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:543) at
 com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501) at
 com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:17
 9) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:788) at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScanneImpl.java:1343) at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756) at
 com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647) at  com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at
 com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at
 com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at
 com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at
 com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at
 javax.xml.parsers.SAXParser.parse(SAXParser.java:395) at javax.xml.parsers.SAXParser.parse(SAXParser.java:198) at
 org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:17) at
 org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:10) at org.testng.xml.Parser.parse(Parser.java:172) at
 org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:311) at
 org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88) at
 org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204) at
 org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

Steps to resolve the above error

  • Step 1 : Right click on project and select TestNG. And now select .Convert to TestNG ‘ option as shown in figure below.

TestNG_Config.png

  • Step 2: Now you have check the below highlighted portions of configurations like location, Suite name, Test name, mode selection, etc. Once this is done, click ‘Finish’.

TEstNG-Step2

  • Step 3: Now you have to run the project, for this go to testng.xml  formed in above steps. Right click on it and select ‘Run configuration’.

You will get the below screen , where in you need yo specify the below highlighted areas of configurations. Check the suite name is correct, JRE version of project, whether it is pointing to the correct testng.xml or not, etc.

QueuingTestNG

Once you are done with this, click on ‘Run’ and you are done.

Console output should be:

[TestNG] Running:
  F:\GridParallelDemo\GridParallelDemo\queuingtestng.xml
===============================================
Test Suite
Total tests run: 2, Failures: 0, Skips: 0
===============================================
Advertisements

One thought on “java.lang.UnsupportedClassVersionError: Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s