NetBeans 7.2 and Maven based JavaFX2.2 based project

Oracle has not yet made it easy for developers to build javafx apps using Maven.

Here are my steps on Ubuntu Linux 12.04 64bit:

1. install the latest JDK (64bit) – since java 7 update 6 this includes Java FX 2.2

2. In order for your programs to compile add the following dependency to your pom.xml file (updaing the path as required):

<dependency>
<groupId>com.oracle</groupId>
<artifactId>javafx</artifactId>
<version>2.2</version>
<scope>system</scope>
<systemPath>/home/someuser/apps/jdk1.7.0_07/jre/lib/jfxrt.jar</systemPath>
</dependency>

3. In order for your programs to run make sure that you have jxfrt.jar in your /jre/lib/ext directory. I have done this by creating a symbolic link for the jar file in jre/lib directory to jre/lib/ext:
> cd /home/somuser/apps/jdk1.7.0_07/jre/lib/ext
> ln -s /home/someuser/apps/jdk1.7.0_07/jre/lib/jfxrt.jar .

4. to make sure that the JDK where you have copied/symlinked the JafaFX jar is used as default Java Platform in NetBeans you might need to modify the file /home/someuser/apps/netbeans-7.2/etc/netbeans.conf
Just update the variable netbeans_jdkhome to point to the JDK that you want to use:
netbeans_jdkhome=”/home/somuser/apps/jdk1.7.0_07″

Advertisements