Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Leiningen & Cygwin Working

I am trying to get Leiningen and Cygwin working together.

One of the problems I think I have is that I have Java installed in "C:\Program Files\Java..." directory. The space appears to be causing issues.

When I try to run the lein script in Cygwin, I am getting the following error:

./lein: line 325: C:\Program Files\Java\jdk1.8.0_05\bin\java.exe : command not found

Then I thought the issue was the space. So I changed line 325 from:

"$LEIN_JAVA_CMD" \

to (for testing purposes):

"$'C:\\\Program Files\\\Java\\\jdk1.8.0_05\\\bin\\\java.exe'" \

But, I am still getting this error:

./lein: line 325: $'C:\\Program Files\\Java\\jdk1.8.0_05\\bin\\java.exe' : commande introuvable

However, this file clearly exists:

Owner@Owner-PC ~
$ ls -alh $'C:\\Program Files\\Java\\jdk1.8.0_05\\bin\\java.exe'
-rwxr-xr-x 1 Owner None 187K  8 mai   15:39 C:\Program Files\Java\jdk1.8.0_05\bin\java.exe

The lein script appears to be properly configuring Leiningen for Cygwin, however I can't get it to work.

Note that I previously installed Leiningen outside of Cygwin (I was running it in Windows' normal shell).

What could be wrong with my setup, any ideas?

like image 253
Neoasimov Avatar asked Jul 08 '14 14:07

Neoasimov


People also ask

What is Lein DEPS?

The goal of the "deps" target is to ensure that every dependency required to run this project is available in your local maven repo. In short it populates ~/.m2/... with jars that need to be on the class-path for the project to run. If lein finds the dependency, which is the required version of a project, in ~/.

How do I run a Clojure project?

Create a new Clojure project with Leiningen. Build the project to create an executable JAR file. Execute the JAR file. Execute code in a Clojure REPL.


2 Answers

I use Leiningen via Cygwin with no problems.

Start over

Start over with a fresh copy of the lein script. There should be no need to edit it.

Set your PATH to include java

The easiest solution is to set your path in ~/.profile to include the path to Java's bin directory. Lein will then find java on the path and you'll have access to java and its related tools in your shell.

export JAVA_HOME="/cygdrive/c/Program Files/Java/jdk1.8.0_05/"
export PATH="${JAVA_HOME}/bin/:${PATH}"

Restart your shell or source ~/.profile. Verify that which java finds java command. And run java to verify you get the help output.

And/or explicitly set the LEIN_JAVA_CMD and JAVA_CMD variables

Alternatively, set the LEIN_JAVA_CMD and JAVA_CMD variables used by lein in your ~/.profile

export JAVA_HOME="/cygdrive/c/Program Files/Java/jdk1.8.0_05/"
export LEIN_JAVA_CMD="${JAVA_HOME}/bin/java"
export JAVA_CMD=`cygpath -w "${LEIN_JAVA_CMD}"`

Restart your shell or source ~/.profile.

Note: You can also set a separate LEIN_JVM_OPTS and JVM_OPTS if desired, but this should not be necessary.

like image 184
A. Webb Avatar answered Oct 18 '22 16:10

A. Webb


If you have lein previously installed on Windows and want to reach it from cygwin, then do:

on cmd:

cd C:/Users/%userprofile%/.lein/bin
mklink lein lein.bat

on cygwin:

export CYGWIN=winsymlinks:nativestrict
like image 22
Oleg Ko Avatar answered Oct 18 '22 16:10

Oleg Ko