technomancy / leiningen

Moved to Codeberg; this is a convenience mirror
https://codeberg.org/leiningen/leiningen
Other
7.29k stars 1.61k forks source link

mingw #523

Closed ghost closed 11 years ago

ghost commented 12 years ago

There is an issue classpath running lein2 on mingw32 shell:


Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main


It seems that there is a problem with classpath separator: mingw separator is ';' (semicolumn) ?

leonelag commented 12 years ago

What do you get when setting the env variable DEBUG ? As in:

DEBUG=1 lein help DEBUG=1 lein

ghost commented 12 years ago

I get that:


CLASSPATH="";"";";C:\Users\Pierre.lein\plugins\appengine-magic-0.4.6.jar;C:\Users\Pierre.lein\plug ins\cljs-template-0.1.4.jar;C:\Users\Pierre.lein\plugins\lein-clojars-0.7.0.jar;C:\Users\Pierre.le in\plugins\lein-noir-1.2.0.jar;C:\Users\Pierre.lein\plugins\swank-clojure-1.3.4.jar";test;src;"C:\U sers\Pierre.lein\self-installs\leiningen-2.0.0-SNAPSHOT-standalone.jar" Exception in thread "main" java.io.FileNotFoundException: Could not locate leiningen/coreinit.clas s or leiningen/core.clj on classpath: at clojure.lang.RT.load(RT.java:432) at clojure.lang.RT.load(RT.java:400) at clojure.core$load$fn4890.invoke(core.clj:5415) at clojure.core$load.doInvoke(core.clj:5414) at clojure.lang.RestFn.invoke(RestFn.java:408)


trptcolin commented 12 years ago

Is this using lein.bat or the lein bash script? Everything below is related to using the bash script version, which worked for me, with some caveats. If this is using lein.bat, maybe try using the lein script instead?

I see the same error if I set up entries on the CLASSPATH myself using semicolons, but when using colons, that works fine. It seems mingw is ok with using either : or ; as the separator, as long as it's consistent. And since lein builds up its own classpath using :, I'd recommend using : if you really need to manipulate the CLASSPATH.

Incidentally, when using the user profile mechanism described in https://github.com/technomancy/leiningen/wiki/Upgrading, you can get the plugin functionality without building the classpath up yourself.

leonelag commented 12 years ago

It seems mingw is ok with using either : or ; as the separator, as long as it's consistent.

Ouch ! Red alert there !

Mingw and cygwin blur some of the differences between on Unix vs Windows paths; in particular, in Mingw/Cygwin, the PATH variable is a list of :-separated variables.

However, the CLASSPATH is only a variable used to build the -cp part of the command line used to invoke the java executable. It's java.exe for Windows, which expects a list of ;-separated values.

I've been bitten by this issue before, and I'd be really surprised if java.exe for Windows had started accepting class paths separated by colons.

leonelag commented 12 years ago

In any case, I see that Pierre's command line is strange. It shows:

IS:        C:\Users\Pierre.lein\...
SHOULD be: C:\Users\Pierre\.lein\...
                          ^......Notice the slash.

Try to set your variable $HOME to C:\Users\Pierre\ and let us know the results.

trptcolin commented 12 years ago

http://sourceforge.net/mailarchive/forum.php?thread_name=4D7E25C0.7070001%40beuth-hochschule.de&forum_name=mingw-users

ghost commented 12 years ago

Thanks for your help.

Mingw has $OSTYPE=msys which is not tested in script Old lein(1) gives that:


;;;/c/Users/Pierre/.lein/plugins/appengine-magic-0.4.6.jar;/c/Users/Pierre/.lein/plugins/cljs-template-0 .1.4.jar;/c/Users/Pierre/.lein/plugins/lein-clojars-0.7.0.jar;/c/Users/Pierre/.lein/plugins/lein-noir-1. 2.0.jar;/c/Users/Pierre/.lein/plugins/swank-clojure-1.3.4.jar;;test/;src/;resources/;/c/Users/Pierre/.le in/lib/ant-1.6.5.jar;/c/Users/Pierre/.lein/lib/ant-launcher-1.6.5.jar;/c/Users/Pierre/.lein/lib/classwor lds-1.1-alpha-2.jar;/c/Users/Pierre/.lein/lib/clj-gae;/c/Users/Pierre/.lein/lib/clojure-1.2.1.jar;/c/Use rs/Pierre/.lein/lib/clojure-contrib-1.2.0.jar;/c/Users/Pierre/.lein/lib/compojure-0.6.5.jar;/c/Users/Pie rre/.lein/lib/jline-0.9.94.jar;/c/Users/Pierre/.lein/lib/jtidy-4aug2000r7-dev.jar;/c/Users/Pierre/.lein/ lib/junit-3.8.1.jar;/c/Users/Pierre/.lein/lib/leiningen-1.6.2-standalone.jar;/c/Users/Pierre/.lein/lib/l einingen-2.0.0-SNAPSHOT-standalone.jar;/c/Users/Pierre/.lein/lib/maven-ant-tasks-2.0.10.jar;/c/Users/Pie rre/.lein/lib/maven-artifact-2.0.10.jar;/c/Users/Pierre/.lein/lib/maven-artifact-manager-2.0.10.jar;/c/U sers/Pierre/.lein/lib/maven-error-diagnostics-2.0.10.jar;/c/Users/Pierre/.lein/lib/maven-model-2.0.10.ja r;/c/Users/Pierre/.lein/lib/maven-plugin-registry-2.0.10.jar;/c/Users/Pierre/.lein/lib/maven-profile-2.0 .10.jar;/c/Users/Pierre/.lein/lib/maven-project-2.0.10.jar;/c/Users/Pierre/.lein/lib/maven-repository-me tadata-2.0.10.jar;/c/Users/Pierre/.lein/lib/maven-settings-2.0.10.jar;/c/Users/Pierre/.lein/lib/plexus-c ontainer-default-1.0-alpha-9-stable-1.jar;/c/Users/Pierre/.lein/lib/plexus-interpolation-1.1.jar;/c/User s/Pierre/.lein/lib/plexus-utils-1.5.5.jar;/c/Users/Pierre/.lein/lib/swank-clojure-1.2.1.jar;/c/Users/Pie rre/.lein/lib/swingrepl-1.0.0-20100502.112537-4.jar;/c/Users/Pierre/.lein/lib/wagon-file-1.0-beta-2.jar; /c/Users/Pierre/.lein/lib/wagon-http-lightweight-1.0-beta-2.jar;/c/Users/Pierre/.lein/lib/wagon-http-sha red-1.0-beta-2.jar;/c/Users/Pierre/.lein/lib/wagon-provider-api-1.0-beta-2.jar;/c/Users/Pierre/.lein/lib /xml-apis-1.0.b2.jar Exception in thread "main" java.lang.NoClassDefFoundError: jline/ConsoleRunner Caused by: java.lang.ClassNotFoundException: jline.ConsoleRunner


which is 'normal' since CLOJURE_JAR is not inthe CLASSPATH.

With lein2:


Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main Caused by: java.lang.ClassNotFoundException: clojure.main


lein2 and lein1 both works fine on windows cmd shell (.bat)

HTH Thanks

technomancy commented 12 years ago

The lein shell script checks "$OSTYPE" = "cygwin" in order to run the cygpath binary to convert colon paths to semicolons. We could also check for "$OSTYPE" = "msys", but it sounds like that wouldn't help if cygpath is not present. Does mingw have its own equivalent utility?

technomancy commented 11 years ago

Sounds like this is fixed by #1057

DesmondHayes commented 10 years ago

Hi, @technomancy! I've had this issue recently with leiningen 2.3.4. With MSYS version that I'm using (which is msys+7za+wget+svn+git+mercurial+cvs-rev13.7z from http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/) in combination with MinGW-w64 I had to manually roll back changes of commit #1057 to make lein work. I'll just leave this note here in case anybody cares.