Skip to main content

Release wroken - UnsupportedClassVersionError

3 replies [Last post]
rlopes
Offline
Joined: 2004-09-22
Points: 0

I can compile using the mustang release, but when i try to run the compiled classes i get this:

run:
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Exception in thread "main"
Java Result: 1

The javah gives me thi output:

javah -classpath build\classes thumbs.Main
error: cannot access thumbs.Main
bad class file: build\classes\thumbs\Main.class
class file has wrong version 50.0, should be 49.0

java -version gives me this:

java version "1.6.0-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b31)
Java HotSpot(TM) Client VM (build 1.6.0-ea-b31, mixed mode, sharing)

How do i fix this?

Thanks,
Ricardo Lopes.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
peterahe
Offline
Joined: 2004-11-22
Points: 0

Don't use -source 6 or -target 6, it isn't ready yet.
If you're using NetBeans right-click on your project
and select properties. Go to Build/Compiling and
add the options -source 5 -target 5.

rlopes
Offline
Joined: 2004-09-22
Points: 0

Thanks, that worked.

I wasn't using any source/target i was doing a plain javac with a classpath, the compiler was assuming -target 6 not me, i was a using a custom ant script to build/run.

After putting the source/target on the ant script is running fine.

Thank you very much,

Ricardo Lopes.

tboudri
Offline
Joined: 2005-07-30
Points: 0

I'am using JBuilder 2005.
I have just downloaded and installed Mustang b45 and now have the same problem. Except that JBuilder complains during rebuild.
This problem did not exist in Mustang b43 and b44

How can i solve this in JBuilder?