title: Why is my Java Desktop Application Failing to Run?
body: <p>I have a Java Desktop Application with JavaFX 2 which I built and then I tried to run the JAR. The run failed so I ran it through the Command Line to get the errors. Here is what I got:</p>
  
  <p>Edit: I updated the stack trace as some lines of code have been added/removed (The error is the same)</p>
  
  <pre><code>C:\Users\user\Desktop&gt;java -jar DesktopApp.jar
  Error: failed to msvcr100.dll java.lang.UnsatisfiedLinkError: Can't load library: C:\Users\user\Desktop\bin\msvcr100.dll
  *** Fallback to Prism SW pipeline
  Exception in thread "main" java.lang.ExceptionInInitializerError
  Caused by: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: Can't load library: C:\Users\user\Desktop\bin\mat.dll
          at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:252)
          at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:30)
          at javafx.embed.swing.JFXPanel.initFx(JFXPanel.java:128)
          at javafx.embed.swing.JFXPanel.&lt;init&gt;(JFXPanel.java:138)
          at app.Main.&lt;clinit&gt;(Main.java:150)
  Caused by: java.lang.UnsatisfiedLinkError: Can't load library: C:\Users\user\Desktop\bin\mat.dll
          at java.lang.ClassLoader.loadLibrary(Unknown Source)
          at java.lang.Runtime.load0(Unknown Source)
          at java.lang.System.load(Unknown Source)
          at com.sun.glass.utils.NativeLibLoader.loadLibraryFullPath(NativeLibLoader.java:155)
          at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:85)
          at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:30)
          at com.sun.glass.ui.Application$1.run(Application.java:27)
          at java.security.AccessController.doPrivileged(Native Method)
          at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:25)
          at com.sun.glass.ui.win.WinApplication.&lt;clinit&gt;(WinApplication.java:33)
          at com.sun.glass.ui.win.WinPlatformFactory.createApplication(WinPlatformFactory.java:20)
          at com.sun.glass.ui.win.WinPlatformFactory.createApplication(WinPlatformFactory.java:17)
          at com.sun.glass.ui.Application.Run(Application.java:49)
          at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:242)
          ... 4 more
  Could not find the main class: app.Main. Program will exit.
  </code></pre>
  
  <p>Edit: Line 150 in Main.java is <code>public static JFXPanel javafxPanel = new JFXPanel</code>. It appears that FX is requiring <em>mat.dll</em> and it is looking in the wrong place for it so it can't find it. I am running the program on a Vista (32bit) but when I run on Windows 7 (64bit) the first line (below) is not there.</p>
  
  <pre><code>Error: failed to msvcr100.dll java.lang.UnsatisfiedLinkError: Can't load library: C:\Users\user\Desktop\bin\msvcr100.dll
  </code></pre>
  
  <hr>
  
  <p><strong>After More Research:</strong></p>
  
  <p>After some internet research I found the below similar discussions which I am still studying: </p>
  
  <ul>
  <li><a href="http://forums.oracle.com/forums/thread.jspa?threadID=2230876&amp;tstart=31" rel="nofollow">http://forums.oracle.com/forums/thread.jspa?threadID=2230876&amp;tstart=31</a></li>
  <li><a href="http://forums.oracle.com/forums/thread.jspa?threadID=2250369" rel="nofollow">http://forums.oracle.com/forums/thread.jspa?threadID=2250369</a></li>
  <li><a href="http://netbeans.org/bugzilla/show_bug.cgi?id=198599" rel="nofollow">http://netbeans.org/bugzilla/show_bug.cgi?id=198599</a></li>
  </ul>
  
  <p>It looks like <em>msvcr100.dll</em> and <em>mat.dll</em> are related to the JavaFX Runtime. I have the JavaFX Netbeans Plugin but I did not have the runtime. I now have it but that did not fix or change the problem. I found msvcr100.dll and mat.dll in ....netbeans\7.0\lib\javafx2-win\bin\ and also (after I installed the runtime) in C:\Program Files\Oracle\JavaFX Runtime 2.0\bin. It appears that my program is looking in the right place when run with Netbeans.</p>
  
  <hr>
  
  <p>This is not the first time I ran this program. In past tries it was successful. Running through Netbeans does not produce any errors and the program runs properly.</p>
  
  <p>Could this be an FX bug? How do I get my program to look in the right place and why is it not?</p>