title: UnsatisfiedLinkError When Loading a Library from Java in MATLAB
body: <p>I've been integrating simple java modules into the MATLAB environment on Windows with some success. Recently I encountered a problem with a third-party library which attempts to load a dll.</p>
  
  <p>The java ClassLoader throws the UnsatisfiedLinkError when the load is attempted:</p>
  
  <pre><code>java.lang.UnsatisfiedLinkError: no &lt;libname&gt; in java.library.path
  
  at java.lang.ClassLoader.loadLibrary(Unknown Source)
  
  at java.lang.Runtime.loadLibrary0(Unknown Source)
  
  at java.lang.System.loadLibrary(Unknown Source)
  </code></pre>
  
  <p>The exception is reporting that my 'libname' is not in the java.library.path property. I have verified that the property does indeed have the correct path in it, and that the libname.dll file exists on that path. </p>
  
  <p>I verified java.library.path in two ways. First, I simply checked that value returned on the MATLAB command line:</p>
  
  <pre><code>&gt;&gt; java.lang.System.getProperty('java.library.path')
  </code></pre>
  
  <p>Then, I modified the java method in question to print that value just before the call into the failing third-party function:</p>
  
  <pre><code>System.out.println(System.getProperty('java.library.path'));
  </code></pre>
  
  <p>Both confirmed that my path value was set as expected.</p>
  
  <p>I've also tried manually loading the library from the command line, and it fails with the same results.</p>
  
  <p>Is this something that is not possible in MATLAB, or am I missing something here? Unfortunately I'm not administrator on this machine so I can't try the old trick of moving the dll into a directory with dlls that do work.</p>
  
  <p>I welcome any suggestions for things to try if there is no absolute answer.</p>
  
  <p>Platform:
  Windows XP
  MATLAB R2009a
  Java 1.6</p>