Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lein.bat fails to start repl in windows xp

I'm trying to install Leiningen in order to install Overtone.

Following the directions for installing Leiningen, I:

Installed JDK7u25 Installed leiningen 2.2.0

Can't get any further because:

When I run lein.bat, I get this message: "Error: Could not find or load main class' and -that's the end of the error message.

This happens when the computer runs the following batch file command:

 "%LEIN_JAVA_CMD%" -client %LEIN_JVM_OPTS% ^
 -Dclojure.compile.path="%DIR_CONTAINING%/target/classes" ^
 -Dleiningen.original.pwd="%ORIGINAL_PWD%" ^
 -cp %CLASSPATH% clojure.main -m leiningen.core.main %*

I've checked the environment variable for the location of java.exe and the path for leiningen\bin and they are both correct. Both the Java installation and leinginen installation look fine: everything seems to be there and be in the right places.

When I rem out the @echo off in the batch file, the console output shows that the paths used for both java.exe and leiningen-2.2.0-standalone.jar are correct. The only odd thing to a windows user is the -Dclojure.compile.path, which is "E:\Documents and settings\<myname>\.lein/target/classes" -- the 2 forward slashes "/" cannot be part of any windows path, but maybe they may make sense to java.

I'm new to all this stuff. Is there something missing from the instructions that's so obvious it wasn't included? Or is the problem just with me or my system.

Thanks for any help or ideas.

like image 611
MacPherson Avatar asked Jun 23 '13 03:06

MacPherson


3 Answers

You need to fix the lein.bat file.

Line 27: Put quotes around the variable setting for LEIN_JAR, so:

if "x%LEIN_JAR%" == "x" set LEIN_JAR="!LEIN_HOME!\self-installs\leiningen-!LEIN_VERSION!-standalone.jar"

That should get lein running, it still throws up an error "no such command and" but I expect that is the same issue later in the .bat file. Lein still runs however.

like image 101
Mike Avatar answered Sep 24 '22 19:09

Mike


Leningen 2.2.0

I am working on windows XP.(ONLY FOR WINDOWS XP)

I tried all the suggestion above, but it didn't work.

Error: Could not find or load main class

The problem is with spaces in path. I found a different workaround

  1. Download lein.bat from http://leiningen.org/
  2. there is no need to edit lein.bat
  3. create a directory in c:\lein\bin (DON'T USE "C:\Documents and Settings\Administrator\.lein")
  4. Put lein.bat in c:\lein\bin\lein.bat
  5. Put c:\lein\bin in your "enviroment variable" PATH
  6. Put c:\lein in your "enviroment variable" LEIN_HOME
  7. from cmd run lein self-installs
  8. This command download the file in "C:\LEIN\self-installs\leiningen-2.2.0-standalone.jar"

Use lein repl to start

like image 22
user2653680 Avatar answered Sep 24 '22 19:09

user2653680


A simple workaround is to move the .lein folder to C:\lein and set environment variables properly

move "%userprofile%\.lein" c:\lein
set LEIN_HOME=C:\lein
set PATH=%PATH%;C:\lein\bin

then you can run

$lein repl
like image 27
Jaime Agudo Avatar answered Sep 21 '22 19:09

Jaime Agudo