Posted by: Morten Nobel-Jørgensen | October 19, 2008

Scenegraph Shell 0.3 – Eclipse compiler in JWS

In this blog, I’ll introduce the new features in Scenegraph Shell version 0.3 and describe the trouble I had, when I tried using the Eclipse compiler in Java Web Start. If you didn’t read my blog about Using Eclipse compiler to create dynamic Java objects I suggest that you skip the last part.

Scenegraph Shell 0.3

I have released a new version of Scenegraph Shell, which finally allows you to visualize Java Scenegraph code on the fly in Java Web Start. In the previous version this only worked when running as standalone application.
I have also added multiline error highlight in the simple Java editor that marks the line numbers red.
I also added the newest version of Java Scenegraph (Rev. 324 – 16-10-08), with features such as multiline text.
Finally I have added the build script for the application. The build script both compiles, pack and sign the applications (signing requires that you have setup a code signing certificate on your computer – a test certificate will be sufficient).


Try the application here:

And the source code:

The Eclipse compiler/Java Web Start problem explained

The main purpose of adding the full Java language support to version 0.2 was to be able to play with Java Scenegraph from a simple Web Start application. Using the Eclipse compiler, I created Java bytecode, and loaded the objects using a simple custom class loader.
This worked perfectly during development, but when I finally ran it using Java Web Start, the Eclipse compiler didn’t have access to Java Scenegraph classes packaged in the jar file.
The reason for this is that the Web Start uses an URLClassLoader on top of the default class loader, but the Eclipse compiler used the default class loader.

Event though the problem seemed to be simple, I gave up, and launched version 0.2 without Web Start support for Java compilation.

The solution

Thanks to Mark Greenwood’s blog about the issue Compiled Code Compiles Code, I was able to solve the problem.
Mark solved the problem by not using the new Java 1.6 interface JavaCompiler, but instead he used the Eclipse compiler directly. Read the details in Marks blog.
Thanks to Mark, I finally was able compile and invoke Java objects in Web Start.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: