title: How do I use a .jar file in my project and compile it without an IDE?
body: <p>I am currently trying to include the jnativehook library and test out one of its examples.</p>
  
  <p>I downloaded the .jar file from its website and created a .java file which has an example program. These are in the same folder.</p>
  
  <p>I have followed other questions on here which have tried to tell me how to compile and run the program. I have tried:</p>
  
  <pre><code>javac -classpath jnativehook-2.1.0.jar GlobalKeyListenerExample.java
  java -classpath jnativehook-2.1.0.jar GlobalKeyListenerExample
  </code></pre>
  
  <p>It compiles fine, however when I enter the second command to run it I get:</p>
  
  <pre><code>Error: Could not find or load main class GlobalKeyListenerExample
  Caused by: java.lang.ClassNotFoundException: GlobalKeyListenerExample
  </code></pre>
  
  <p>All I want to do is be able to include a .jar file in my project and compile it from the command line. I am not using eclipse at the moment because I am getting too many problems with it and I also want to learn to program without IDEs.</p>
  
  <p>(I am on windows by the way). Also, please do not mark this as duplicate. If it was actually a duplicate then I would be able to find a solution to my problem from the other similar questions.</p>