title: JavaFX 2.0 + NetBeans + Maven
body: <p>I am creating JavaFX <strong>2.0</strong> application using NetBeans 7.0.1. When I create project in standard way everything works fine. Unfortunately ;) I need <strong>Maven</strong> project...</p>
  
  <p>I didn't find JavaFX 2.0 in Maven repository, so my pom.xml right now looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;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"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;mygroup&lt;/groupId&gt;
      &lt;artifactId&gt;ui&lt;/artifactId&gt;
      &lt;version&gt;0.1&lt;/version&gt;
      &lt;name&gt;My Project&lt;/name&gt;
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javafx&lt;/groupId&gt;
              &lt;artifactId&gt;jfxrt&lt;/artifactId&gt;
              &lt;version&gt;2.0&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
              &lt;scope&gt;system&lt;/scope&gt;
              &lt;systemPath&gt;${env.JAVAFX_HOME}\lib\jfxrt.jar&lt;/systemPath&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>JAVAFX_HOME system variable is set:</p>
  
  <pre><code>C:\Users\rach&gt;echo %JAVAFX_HOME%
  C:\Program Files\Oracle\JavaFX Runtime 2.0\
  </code></pre>
  
  <p>Compilation goes okay, but when I start program under NetBeans I got error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application at java.lang.ClassLoader.defineClass1(Native Method)
  </code></pre>
  
  <p>However jfxrt.jar is in classpath:</p>
  
  <pre><code>C:\&gt;echo %CLASSPATH%
  C:\Program Files\Oracle\JavaFX Runtime 2.0\lib\jfxrt.jar
  </code></pre>
  
  <p>When I start my application from command line it works fine.</p>
  
  <p>When I install jfxrt.jar in local repository at runtime application still does not start because it cannot find <em>C:\Program Files\Oracle\JavaFX Runtime 2.0\bin\mat.dll</em>. Pom.xml:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;javafx&lt;/groupId&gt;
      &lt;artifactId&gt;jfxrt&lt;/artifactId&gt;
      &lt;version&gt;2.0&lt;/version&gt;
      &lt;type&gt;jar&lt;/type&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Effect:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>Any ideas?</p>