Java FX in Eclipse on Mac OSX 10.7


Question

Since I had problems with compiling JavaFX Code from Eclipse on Mac OSX 10.7 using java development kit 1.7.0_04 i just want to share my intermediate solution with interested people:

Problem:

  • The jfxrt.jar and other .jar files are not recognized when selecting the new jdk issued by oracle as a new jre/jdk in eclipse.

  • The jdk is installed within /Library/Java/JavaVirtualMachines/1.7.0.jdk which is recognized as a package.

  • Adding the path /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre/lib/jfxrt.jar later is not possible since the file open dialog of eclipse does not allow to navigate to the inside of the package

Solution: Create a symbolic link from outside the package to inside the package and follow the link within the file open dialog.

Simply go to a terminal and execute the following:

[0-/Library/Java/JavaVirtualMachines]:sudo ln -s 1.7.0.jdk/Contents/ 1.7.0.jdk_Contents

This creates the symbolic link 1.7.0.jdk_Contents using super user permissions (sudo).

By this compilation and execution of JavaFx code works fine and as expected.

1
5
5/18/2012 10:13:57 PM

It's not need to do all said before, just use a allmost unknown behaviour of Finder dialogs: Drag & Drop. You can open a Finder window from console with:

open /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre/lib

so yo will see jfxrt.jar and other .jar files. Drag this files to Eclipse's Add external jar dialog window... et voila! Dependencies satisfaced! No link needed!

2
7/24/2013 4:57:02 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon