title: How to run a maven-packaged clojure application from the jar
body: <p>I have the following contents in <code>src/main/clojure/za/co/pb/maven_test/test.clj</code> file:</p>
  
  <pre><code>(ns za.co.pb.maven-test.test
    (:gen-class))
  
  (defn -main []
    (println "Hello world!"))
  </code></pre>
  
  <p>I also have a POM that has the necesary dependencies on clojure-maven-plugin with the compile execution.</p>
  
  <p>If I execute a <code>mvn package</code> command, I get a <code>target/maven-test-1.0-SNAPSHOT.jar</code> file and if I look in the classes folder I have these files in the folder <code>target/classes/za/co/pb/maven_test</code>:</p>
  
  <ul>
  <li><code>test.class</code></li>
  <li><code>test.clj</code></li>
  <li><code>test__init.class</code></li>
  <li><code>test$loading__4410__auto__.class</code></li>
  <li><code>test$_main.class</code></li>
  </ul>
  
  <p>This, as far as I know, is appropriate.</p>
  
  <p>However, when I run this command: </p>
  
  <p><code>java -cp target\app-1.0-SNAPSHOT.jar za.co.pb.maven_test.test</code></p>
  
  <p>I get this:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/IFn
  Caused by: java.lang.ClassNotFoundException: clojure.lang.IFn
      at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
  Could not find the main class: za.co.pb.maven_test.test. Program will exit.
  </code></pre>