Cymen Vig

Software Craftsman

Leningin, uberjar and Exception in thread "main" java.lang.NoClassDefFoundError: ...

The bare minimum to get a leningin uberjar to run properly on the command line is:

  1. The namespace that contains -main method must have :gen-class applied like so:
1
2
(hello-world.core
  (:gen-class))
  1. The project.clj must have a :main setting that points to the namespace containing -main:

    … :main hello-world.core …

Now both lein run and java -jar hello-world-1.0.0-SNAPSHOT-standalone.jar produce the output Hello world!. This project is on github as “hello world”.