title: How to fix an UnsatisfiedLinkError (Can't find dependent libraries) in a JNI project
body: <p>I'm working on a Java project that uses the JNI.  The JNI calls a custom library that I've written myself, let's say mylib.dll, and that depends on a 3rd party library, libsndfile-1.dll.</p>
  
  <p>When I run my program it crashes with </p>
  
  <pre><code>java.lang.UnsatisfiedLinkError:  C:\...path...\mylib.dll: Can't find dependent libraries.
  </code></pre>
  
  <p>I've searched this site (and others) and I've tried a number of fixes:</p>
  
  <ol>
  <li><p>I ran dependency walker. DW gave a couple of warnings -- that two libraries required by libsndfile, MPR.DLL and SHLWAPI.DLL, had "unresolved imports" -- but the <a href="http://www.dependencywalker.com/faq.html" rel="noreferrer">DW FAQ</a> said that these warnings could be safely ignored. </p></li>
  <li><p>I fixed the method names in mylib.dll, as suggested <a href="http://witte-consulting.com/blog/jni-java-native-interface-exception-in-thread-main-javalangunsatisfiedlinkerror-can-t-find-dependent-libraries/" rel="noreferrer">here</a>.  The method names had somehow gotten mangled by the compiler, but I added linker flags and the dll method names now match those in my jni header file exactly.</p></li>
  <li><p>I put all of these DLLs in the same directory -- the same directory as the .jar that calls them -- to ensure that they're on the right PATH.</p></li>
  </ol>
  
  <p>No dice.</p>
  
  <p>Does anyone have any idea what's going on?</p>
  
  <p>I'm doing my development in Visual Studio 2010 on a MacBook pro (via Parallels). I'm doing my testing in Windows XP on a toshiba laptop.</p>