leiningen
leiningen copied to clipboard
"lein trampoline run" on Windows 7 produces "Error: Could not find or load main class clojure.main"
Steps to reproduce:
lein new app helloworld
cd helloworld
lein run
Hello, World!
lein trampoline run
Error: Could not find or load main class clojure.main
Output of lein classpath clearly contains clojure-1.5.1.jar located in ~/.m2/repository
My HOME directory name contains Cyrillic symbols. I thought that this may be a problem and tried to move my local Maven repository to another location by changing Maven's settings.xml. I set DEBUG env variable and observed that lein trampoline still puts artifacts from ~/.m2/repository on classpath. Of course the paths of the artifacts are expanded and contain Cyrillic symbols.
Next thing I tried is to set :local-repo "local-m2" in .project. Lein trampoline actually started putting dependencies from local-m2 on classpath and the error changed to:
Exception in thread "main" java.io.FileNotFoundException: C:\Users\*GARBLED HOMEDIR NAME*\AppData\Local\Temp\form-init128288074140112765.clj
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:101)
at clojure.lang.Compiler.loadFile(Compiler.java:7017)
at clojure.main$load_script.invoke(main.clj:294)
at clojure.main$init_opt.invoke(main.clj:299)
at clojure.main$initialize.invoke(main.clj:327)
at clojure.main$null_opt.invoke(main.clj:362)
at clojure.main$main.doInvoke(main.clj:440)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
I figured out that I should change my TEMP location. I inspected the directory and found out that trampoline really creates the temporary bat file at the new location and then deletes it. However, trampoline still looks for the file at the old location.
I tried rebooting which did not help.
So, there are at least these issues:
- lein trampoline doesn't support non-ASCII in paths,
- lein trampoline doesn't respect env. variable TEMP.
I would appreciate a fix or a workaround.
I've finally found a workaround. Before running lein trampoline
execute chcp 65001
to set current codepage to UTF-8.
Another problem that I immediately came across to is that the command length in the trampoline bat file was too long for Windows and the error message "The input line is too long" was displayed. I solved this problem by running Leiningen from PowerShell instead of cmd.
I hope this will help other Windows users with Unicode and "input line too long" problems.