Thursday, 27 September 2012

JFX SceneBuilder on Linux

WELL those folks over at Oracle have tried to leave us Linux lads out again, however, the downfall is the very language they use.

JFX SceneBuilder is written in - yep - Java. For those of us with the linux affliction, all you have to do is download the Mac OSX DMG file, this is a 7z'd filesystem. Here are the sweet comments I found on StackOverflow on how to do it: (Works like a charm once you have the latest jvm installed).

Then extract with 7-zip. It's a compressed HFS file system.
$ mkdir javafx_scenebuilder
$ 7z e -ojavafx_scenebuilder javafx_scenebuilder-1_0-macosx-universal.dmg
Now extract the HFS partition:
$ cd javafx_scenebuilder
$ 7z x 4.hfs
This will extract lots of files. You'll only need "JavaFX Scene Builder 1.0/JavaFX Scene Builder". You can remove all other files. Start Scenebuilder:
$ cd "JavaFX Scene Builder 1.0/JavaFX Scene Builder"
$ java -cp javafx-beans-dt.jar:javafx-designtime.jar:jfxrt.jar:SceneBuilder.jar
There'll be an exception upon start saying something about "ClassNotFoundException:", but it'll work anyway.
Note that you'll need JDK7u6 to run it.

My guess is this will work for any system that you can get JDK7u6 and p7zip on.

Heres a neat tip, in the aforementioned dir:
$ echo cd `pwd`  > && echo "java -cp javafx-beans-dt.jar:javafx-designtime.jar:jfxrt.jar:SceneBuilder.jar" >> && chmod +x

This will give you an executable file called, which you can run by double clicking, or by typing ./ and pressing enter.