I am creating JavaFX 2.0 application using NetBeans 7.0.1. When I create project in standard way everything works fine. Unfortunately ;) I need Maven project...
I didn't find JavaFX 2.0 in Maven repository, so my pom.xml right now looks like this:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroup</groupId>
<artifactId>ui</artifactId>
<version>0.1</version>
<name>My Project</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javafx</groupId>
<artifactId>jfxrt</artifactId>
<version>2.0</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${env.JAVAFX_HOME}\lib\jfxrt.jar</systemPath>
</dependency>
</dependencies>
</project>
JAVAFX_HOME system variable is set:
C:\Users\rach>echo %JAVAFX_HOME%
C:\Program Files\Oracle\JavaFX Runtime 2.0\
Compilation goes okay, but when I start program under NetBeans I got error:
Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application at java.lang.ClassLoader.defineClass1(Native Method)
However jfxrt.jar is in classpath:
C:\>echo %CLASSPATH%
C:\Program Files\Oracle\JavaFX Runtime 2.0\lib\jfxrt.jar
When I start my application from command line it works fine.
When I install jfxrt.jar in local repository at runtime application still does not start because it cannot find C:\Program Files\Oracle\JavaFX Runtime 2.0\bin\mat.dll. Pom.xml:
<dependency>
<groupId>javafx</groupId>
<artifactId>jfxrt</artifactId>
<version>2.0</version>
<type>jar</type>
</dependency>
Effect:
Exception in thread "main" java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: Can't load library: C:\Repositories\MavenRepo\javafx\jfxrt\bin\mat.dll at com.sun.javafx.tk.quantum.QuantumToolkit.startup(Unknown Source)
Any ideas?