title: Running my generated .jar yields "Can't load this .dll (machine code=0xbd) on a AMD 64-bit platform"
body: <p>I have a project which is using some native libraries (.dll). I'm using Netbeans, and I've specified java.library.path in the run configuration. Running the project from Netbeans yields no errors.</p>
  
  <p>I'm using Maven, and when building the project my jar is built in the <code>target</code> folder. I'm copying all the .dlls and my program's dependencies to <code>target/lib</code> with maven resources and dependency plugins.</p>
  
  <p>When I try to run my application "outside" of Netbeans, I get the following error:</p>
  
  <pre><code>Can't load this .dll (machine code=0xbd) on a AMD 64-bit platform
  </code></pre>
  
  <p>This is the command I use to run the .jar:</p>
  
  <pre><code>java -Djava.library.path=lib\ -jar abcontrol-1.0-SNAPSHOT.jar
  </code></pre>
  
  <p>This is the command (I think) Netbeans uses to run the project from the IDE:</p>
  
  <pre><code>cd C:\Users\Birger\Workspace\myproject; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_77" cmd /c "\"\"C:\\Program Files\\NetBeans 8.1\\java\\maven\\bin\\mvn.bat\" -Dexec.args=\"-Djava.library.path=lib\\ -classpath %classpath com.mysite.myproject.Main\" -Dexec.executable=\"C:\\Program Files\\Java\\jdk1.8.0_77\\bin\\java.exe\" -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans 8.1\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 org.codehaus.mojo:exec-maven-plugin:1.2.1:exec\""
  </code></pre>
  
  <p>I was thinking maybe the <code>java</code> command uses a different java version than Netbeans, so I tried:</p>
  
  <pre><code>"C:\Program Files\Java\jdk1.8.0_77\bin\java.exe" -Djava.library.path=lib\ -jar abcontrol-1.0-SNAPSHOT.jar
  </code></pre>
  
  <p>But still, I get the same error.</p>
  
  <p>How can I run my application without Netbeans?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>From the answer provided to this question: <a href="https://stackoverflow.com/questions/2062020/how-can-i-tell-if-im-running-in-64-bit-jvm-or-32-bit-jvm-from-within-a-program">How can I tell if I&#39;m running in 64-bit JVM or 32-bit JVM (from within a program)?</a>, I added</p>
  
  <pre><code>System.out.println(System.getProperty("sun.arch.data.model"));
  </code></pre>
  
  <p>To my code to try to get the JVM architecture printed. I ran the application from Netbeans and "outside" netbeans, and in both cases it printed <code>64</code>.</p>
  
  <p><strong>EDIT2</strong></p>
  
  <p>Running <code>java -version</code> prints</p>
  
  <pre><code>java version "1.8.0_77"
  Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
  Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
  </code></pre>
  
  <p><strong>EDIT3</strong></p>
  
  <p>I tried to create another project using the same dependencies and libraries. This time I did NOT use maven, and in this project I get the same errors when I try to run the project:</p>
  
  <p><code>Can't load this .dll (machine code=0xbd) on a AMD 64-bit platform</code></p>
  
  <p>Clearly, maven is doing some magic to get this project to run.</p>
  
  <p><strong>EDIT4</strong> (getting deseprate)</p>
  
  <p>Tried running these two commands</p>
  
  <pre><code>"C:\Program Files\Java\jdk1.8.0_91\jre\bin\java.exe" -d32 -Djava.library.path=lib\ -jar abcontrol-1.0-SNAPSHOT.jar
  "C:\Program Files\Java\jdk1.8.0_91\bin\java.exe" -d32 -Djava.library.path=lib\ -jar abcontrol-1.0-SNAPSHOT.jar
  </code></pre>
  
  <p>Both yields</p>
  
  <pre><code>Error: This Java instance does not support a 32-bit JVM. Please install the desired version.
  </code></pre>