title: Is -Djava.library.path=... equivalent to System.setProperty("java.library.path", ...)
body: <p>I load an external library that is placed in <code>./lib</code>. Are these two solutions to set the java.library.path equivalent?</p>
  
  <ol>
  <li><p>Set path in console when executing jar:</p>
  
  <pre><code>java -Djava.library.path=./lib -jar myApplication.jar
  </code></pre></li>
  <li><p>Set path in the code before loading library:</p>
  
  <pre><code>System.setProperty("java.library.path", "./lib");
  </code></pre></li>
  </ol>
  
  <p>If they <em>are equivalent</em>, why in the second solution can Java not find the library while the first one is ok?</p>
  
  <p>If <em>not</em>, is there a way the set the path in the code?</p>