Bad version number in .class file [message #1697453] |
Thu, 04 June 2015 05:44 |
chris yo Messages: 146 Registered: February 2013 |
Senior Member |
|
|
I am using an older version of Eclipse, and Xtend IDE and I am trying to update to the latest version of Eclipse.
Old Eclipse version: Juno Version 4.2.0
Build id: I20120608-1400
Xtext: 2.3.1.v201208210947
Xtend IDE: 2.3.1.v201208210947
Using J2SE-1.5
New Eclipse version: Luna Version 4.4.2
Build Id: 20150219-0600
Xtext: 2.8.3.v201506010551
Xtend IDE: 2.8.3.v201506010551
Using J2SE-1.5
After I migrated my code, I tried to generate the Xtext Artifacts but I am getting the error:
Could not load class: org.eclipse.core.runtime.OperationCanceledException
Add org.eclipse.equinox.common to the class path.
I added this in my MANIFEST.MF -> Dependencies -> Required Plugins
I am using org.eclipse.equinox.common (3.6.200).
I tried to execute "Generate Xtext Artifacts" again, but this time another error comes up.
0 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Bad version number in .class file
java.lang.UnsupportedClassVersionError: Bad version number in .class file
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$100(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)
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$100(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)
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$100(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)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:75)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
I have checked my MANIFEST.MF, and it said: Bundle-RequiredExecutionEnvironment: J2SE-1.5
My Java Build Path -> Libraries also has JRE System Library [J2SE-1.5].
In Java Compiler, I ticked Enable project specific settings and Use compliance from execution environment 'J2SE-1.5' on the 'Java Build Path'
I have also configured my Preferences -> Java -> Installed JREs -> Execution Environments -> J2SE-1.5 and ticked the compatible JREs.
There is only one perfect match which is the jre1.5.0_22 [perfect match].
I have also compared the settings to my old Eclipse setup and everything is already the same.
Is there something I am missing? Do I need to set the Java version somewhere?
[Updated on: Thu, 04 June 2015 05:45] Report message to a moderator
|
|
|
|
|
Re: Bad version number in .class file [message #1697456 is a reply to message #1697455] |
Thu, 04 June 2015 06:16 |
|
From the Release Notes:
Important Changes
Execution Environment
All Xtext plug-ins now require JavaSE-1.6 as execution environment. Furthermore, the Java code generated by Xtext uses @Override annotations for methods overriding or implementing other declared methods, so the plug-ins into which this code is generated must use at least JavaSE-1.6 as execution environment. If your plug-ins are set to J2SE-1.5 and you run the Xtext 2.8 code generator, you will probably get compiler errors like The method 'm' of type 'T' must override a superclass method; eliminate them by switching to a higher Java version.
but that does not explain why the generator does not run
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
[Updated on: Thu, 04 June 2015 06:16] Report message to a moderator
|
|
|
|
|
|
Re: Bad version number in .class file [message #1697478 is a reply to message #1697470] |
Thu, 04 June 2015 09:35 |
chris yo Messages: 146 Registered: February 2013 |
Senior Member |
|
|
Hi,
I have updated to Java 6 already. And I am able to get past the 'Bad version' error.
The problem now is that I have .antlr-generator-3.2.0.jar in my root directory, which is in the same location when I am using the old Xtext version.
When I try to execute Generate Xtext Artifacts, it showed me this error:
*ATTENTION*
It is recommended to use the ANTLR 3 parser generator (BSD licence - http://www.antlr.org/license.html).
Do you agree to download it (size 1MB) from 'http://download.itemis.com/antlr-generator-3.2.0-patch.jar'?
I downloaded it manually, and placed the .antlr-generator-3.2.0-patch.jar in my root directory, but it still gives me the same error.
Where should I put the antlr so that eclipse can detect it?
[Updated on: Thu, 04 June 2015 09:36] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04388 seconds