Lein.bat fails to start repl in windows xp
Asked Answered
P

3

7

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.

Philippe answered 23/6, 2013 at 3:49 Comment(3)
From which directory are you running this batch file, and what does your CLASSPATH variable look like?Fixation
Just a guess, but try going to a directory without any spaces in the path. See if that helps. The "and" in the error could be coming from the "Documents and settings" directory name.Abigail
FYI, i'm having the same error on windows XP. I created a directory at the root of my c:\ and tried "lein new testproject"... same error.Falsecard
V
3

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.

Vaporescence answered 2/7, 2013 at 3:25 Comment(1)
Mike, thank you for your help and insight. I will send a message to the lein people to let them know.Meet
S
2

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

Sylvanite answered 5/8, 2013 at 16:26 Comment(0)
G
1

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
Graner answered 15/8, 2013 at 11:44 Comment(1)
Thanks - this was the only solution that worked for me to get lein running under XP.Aymer

© 2022 - 2024 — McMap. All rights reserved.