Running NetBeans on top of OpenJDK / IcedTea

Posted 8 Nov 2007 at 15:57 UTC by aph Share This

NetBeans works perfectly on IcedTea, but the installer doesn't.

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.


X is, however, a problem, posted 11 Nov 2007 at 13:23 UTC by audriusa » (Journeyer)

>I always run all my test programs as X clients on a remote mcahine, with >the server running on my desktop machine. It turns out that if you start >6.0 Beta 2 on the same machine as the X server, it displays correctly. This may not be a problem for a single developer who uses his own machine to work at home. However companies may have policy to use several high-end X servers that are accessible from very cheap and weak desktop machines. If they decided to break X support because of any reason, it was a really BAD idea.

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!

X
Share this page