Turning leiningen script into an executable
There were a few problems along the way.
Clojure reports MethodNotFound
Leiningen already contains Clojure 1.2.1. If we intend to run Clojure 1.4, it has to appear on the classpath first. However, when Launch4j wraps a leiningen-standalone.jar, it is the first file that appears on the classpath. The solution is to specify clojure-1.4.0.jar as the main jar.
Launch4j couldn’t find clojure.jar
The documentation was incorrect. The location of the jar files were incorrectly stated to be relative to the exe file. In practice, the executable directory must be explicitly included. e.g. %EXEDIR%\clojure-1.4.0.jar
I was able to wrap clojure.jar into clojure.exe, which performs double-duty as a .jar file. I was able to include clojure.exe into the classpath to save disk space.
<launch4jConfig> <dontWrapJar>true</dontWrapJar> <headerType>console</headerType> <jar>%EXEDIR%\clojure.exe</jar> <outfile>lein.exe</outfile> <errTitle></errTitle> <cmdLine>clojure.main -e "(use 'leiningen.core)(-main)" %@</cmdLine> <chdir></chdir> <priority>normal</priority> <downloadUrl>http://java.com/download</downloadUrl> <supportUrl></supportUrl> <customProcName>false</customProcName> <stayAlive>false</stayAlive> <manifest></manifest> <icon></icon> <classPath> <mainClass>jline.ConsoleRunner</mainClass> <cp>%EXEDIR%\leiningen-1.7.0-standalone.jar</cp> </classPath> <jre> <path></path> <minVersion>1.5.0</minVersion> <maxVersion></maxVersion> <jdkPreference>preferJre</jdkPreference> <opt>-client </opt> <opt>-XX:+TieredCompilation</opt> </jre> </launch4jConfig>