Description of problem: HelloWold.java class HelloWorld { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Hello world!"); } } == console on eclipse == Exception in thread "main" java.lang.UnsupportedClassVersionError: HelloWorld : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:638) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:143) at java.net.URLClassLoader.defineClass(URLClassLoader.java:281) at java.net.URLClassLoader.access$000(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:216) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:209) at java.lang.ClassLoader.loadClass(ClassLoader.java:324) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:269) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:337) Version-Release number of selected component (if applicable): 3.3.0-19.fc8 How reproducible: always Steps to Reproduce: 1. $yum install eclipse 2. launch eclipse 3. Create HelloWorld Project in eclipse tutorial 4. Run Actual results: Expected results: Additional info: $javac ~/workspace/HelloWorld/src/HelloWorld.java $java ~/workspace/HelloWorld/src/HelloWorld Hello world! $ rpm -qa | grep ^eclipse eclipse-cvs-client-3.3.0-19.fc8 eclipse-mylyn-bugzilla-2.0.0-4.fc8 eclipse-jdt-3.3.0-19.fc8 eclipse-ecj-3.3.0-19.fc8 eclipse-changelog-2.5.1-2.fc8 eclipse-mylyn-trac-2.0.0-4.fc8 eclipse-subclipse-1.2.2-6.fc8 eclipse-rpm-editor-0.1.0-7.fc8 eclipse-platform-3.3.0-19.fc8 eclipse-mylyn-java-2.0.0-4.fc8 eclipse-mylyn-2.0.0-4.fc8 eclipse-rcp-3.3.0-19.fc8 eclipse-mylyn-ide-2.0.0-4.fc8 $ rpm -q java-1.7.0-icedtea java-1.7.0-icedtea-1.7.0.0-0.15.b19.snapshot.fc8
After Compiler compliance level is set to 1.4., run works well. Initial Compiler compliance level value is 6. <-- this is bug? Click Restore Defaults, Compiler compliance level changes to 1.4.
I don't understand. Is ecj generating something that IcedTea can't run? Tom, do you have any idea what's up here?
51 is the 1.7 major version so the code is being built by IcedTea. sangu, what JDK is Eclipse configured to run programs with?
$rm -rf ~/.eclipse ~/workspace/ 1. Launch eclipse ( Compiler compliance level 6) 2. Make helloworld project in tutorials (Create Hello World application) 3. Run UnsupportedClassVersionError 1. Window menu -> Preferences - Java - Compiler -> Compiler compliance level 6.0 -> 1.4 2. Run Works well. ----------------- * Compiler compliance level 6 (Initial value) - Run -> UnsupportedClassVersionError * Compiler compliance level 1.4 (Click Restore Defaults) - Run -> Works well.
Looks like there are some troubles with IcedTea: it can't run .class files it generates: javac -target 1.7 Hello.java java Hello Exception in thread "main" java.lang.UnsupportedClassVersionError: Hello : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method)
Updating component.
From openjdk/hotspot/src/share/vm/classfile/classFileParser.cpp: #define JAVA_MAX_SUPPORTED_VERSION 50 OpenJDK represents the Java 1.7 development cycle. It's unknown whether a class file format version bump will be required once Java 1.7 is finalized. In the mean time, people shouldn't be building with -target 1.7 (except maybe javac developers), and I expect JAVA_MAX_SUPPORTED_VERSION 50 is a reminder of this. The correct fix here is to make Eclipse build with -target 1.6 rather than 1.7.
This is going to be difficult.
It turns out it's not difficult at all :) I'm uncomfortable making this change at such a low level, but I guess someone running on OpenJDK can generate 1.7-level bytecode if they so choose by changing their project properties. I've included a patch and a build should show up in rawhide tomorrow (2007-09-27).
Can someone please verify that this is fixed in 3.3.0-22.fc8?
*** Bug 310571 has been marked as a duplicate of this bug. ***
Confirmed fixed in 3.3.0-22.fc8.
Thanks, closing.