Mittwoch, Juli 09, 2008

javafx and Mac OS X

I installed JavaFX as bin package. Unpacked it into /opt/local/lib/javafx and moved everything from archive/openjfx-compiler/dist into it.

Like stated on the page I've set the execution bit and updated the path variable.
export PATH=$PATH:/opt/local/lib/javafx/bin

The first example was HelloCompiledJavaFX.fx.

Starting it lead to the error message:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file

The default version of java and javac on OS X 10.5.4 is 1.5.0_13. As this example worked under linux with Java 1.6 I tried this.

As I'm new to the Mac, I don't know if it is possible to switch the installed Java version via System Preferences. But luckily Java has it's own way.

export PATH=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands:$PATH
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home

And now the JavaFX application runs fine.

Keine Kommentare: