Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Bad version number in .class file(xtext)
Bad version number in .class file [message #1697453] Thu, 04 June 2015 05:44 Go to next message
chris yo is currently offline chris yoFriend
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 #1697454 is a reply to message #1697453] Thu, 04 June 2015 05:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13770
Registered: July 2009
Senior Member
org.eclipse.core.runtime.OperationCanceledException => Add org.eclipse.core.runtime.
i am not sure if xtext still works with Java 5 in all places


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Bad version number in .class file [message #1697455 is a reply to message #1697454] Thu, 04 June 2015 06:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13770
Registered: July 2009
Senior Member
btw can you see from the trace which .class file is affected?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Bad version number in .class file [message #1697456 is a reply to message #1697455] Thu, 04 June 2015 06:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13770
Registered: July 2009
Senior Member
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


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
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 #1697458 is a reply to message #1697455] Thu, 04 June 2015 06:31 Go to previous messageGo to next message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
I updated the dependency and add org.eclipse.core.runtime instead, but the error is still the same.
The error I pasted above is the one I displayed in the console log. How can I get the trace to see which .class file is affected?
Re: Bad version number in .class file [message #1697461 is a reply to message #1697458] Thu, 04 June 2015 06:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13770
Registered: July 2009
Senior Member
Please switch to java 6

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Bad version number in .class file [message #1697470 is a reply to message #1697458] Thu, 04 June 2015 08:47 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7060
Registered: July 2009
Senior Member
HI

You can have to work quite hard to change thoroughly between Java
versions if you have used one version pervasively..

You must do a Clean build after ensuring that either you have no Java 5
installed, or all your relevant projects have had their BREE changed to
Java 6 and that their classpath has been updated, most easily fromn the
manifest overview. THe Package Explorer shows the actual Java version
after each "JRE System Library".

Then make sure that your launch configuration does not allow Java 5.

REgards

Ed Willink


On 04/06/2015 07:31, chris yo wrote:
> I updated the dependency and add org.eclipse.core.runtime instead, but
> the error is still the same. The error I pasted above is the one I
> displayed in the console log. How can I get the trace to see which
> .class file is affected?
Re: Bad version number in .class file [message #1697478 is a reply to message #1697470] Thu, 04 June 2015 09:35 Go to previous messageGo to next message
chris yo is currently offline chris yoFriend
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

Re: Bad version number in .class file [message #1697485 is a reply to message #1697478] Thu, 04 June 2015 10:20 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13770
Registered: July 2009
Senior Member
simply answer with yes or install it (antlr sdk) via the update site http://download.itemis.com/updates/.

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:How is XText terminals match its previous terminal?
Next Topic:Replacing XText expressions with external Java (or other language) code?
Goto Forum:
  


Current Time: Tue Mar 09 08:25:36 GMT 2021

Powered by FUDForum. Page generated in 0.01683 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top