8 Nov 2007 aph   » (Master)

Download netbeans 5.5 from

http://www.netbeans.info/downloads/

OK, run the netbeans installer.

No Java Development Kit(JDK) was found on this system.

Oh dear.

zorro:~ $ java -version
java version "1.7.0"
IcedTea Runtime Environment (build 1.7.0-kojibuilder_27_sep_2007_14_56-b00)
IcedTea Server VM (build 11.0-b05, mixed mode)

OK, so it is there. Looks like the netbeans installer really doesn't like IcedTea.

Try with an old JDK 1.5 version.
Run the netbeans installer. Ah, that's much better!

Initializing InstallShield Wizard........
Launching InstallShield Wizard........

Right, so we have netbeans installed.

zorro:~ $ ./netbeans-5.5.1/bin/netbeans

That works fine. Okay, so let's try running that with IcedTea in --jdkhome rather than Java 1.5:

zorro:~ $ sh -x ./netbeans-5.5.1/bin/netbeans --jdkhome /usr/lib/jvm/java-1.7.0-icedtea-1.7.0.0.x86_64

Alright! That seems to work perfectly. Let's try "Hello, World"

init:
deps-jar:
compile:
run:
Exception in thread "main" java.lang.UnsupportedClassVersionError: javaapplication1/Main : 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)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

Excuse me? What is *that* all about? I'm running on a Java 1.7 VM and compiling on a Java 1.7 VM, but the class file version is wrong. Bizarre.

Let's try that from the command line, so we can see what's going on:

zorro:src $ /usr/lib/jvm/java-1.7.0-icedtea-1.7.0.0.x86_64/bin/javac javaapplication1/Main.java
zorro:src $ java javaapplication1.Main
Hello, world!

So, that works. Let's have a look at the class file version:

zorro:src $ jcf-dump javaapplication1/Main
Reading .class from ./javaapplication1/Main.class.
Magic number: 0xcafebabe, minor_version: 0, major_version: 50.

Hey, it looks like IcedTea's javac defaults to emitting .class files with the Java 1.6 major version. What happens with Java 1.7 and IcedTea's VM?

zorro:src $ /usr/lib/jvm/java-1.7.0-icedtea-1.7.0.0.x86_64/bin/javac -source 1.7 javaapplication1/Main.java
zorro:src $ /usr/lib/jvm/java-1.7.0-icedtea-1.7.0.0.x86_64/bin/java javaapplication1/Main
Exception in thread "main" java.lang.UnsupportedClassVersionError: javaapplication1/Main : Unsupported major.minor version 51.0

Ouch! So, although IcedTea is in theory Java 1.7 its VM will refuse to run .class files in the 1.7 format. Netbeans must be forcing Version 1.7.

OK, right-clock on Project/Properties, and there it is:

Source Level: 1.7

Change that to 1.6, Clean and Build Main Project:

init:
deps-jar:
compile:
run:
Hello, world!
BUILD SUCCESSFUL (total time: 0 seconds)

Alright, so that works. IcedTea is now running netbeans.

As far as I can see everything works perfectly, except for some small font rendering issues. The only real problem is that the netbeans installer won't recognized IcedTea as a valid Java VM, so you have to have Java 1.5 (an unfree VM) installed somewhere to install. Once netbeans is installed you can delete Java 1.5.

We really need to fix this; you shouldn't have to install an unfree JDK to run netbeans on IcedTea.

OK, now I'll try the NetBeans 6.0 beta.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!