I'm trying to run Maven on cygwin. I've added maven to the path and my Java home looks like this:
$ echo $JAVA_HOME
/cygdrive/c/Program Files/Java/jdk1.6.0
Yet when I try to run mvn --version
, I get this:
Error: JAVA_HOME is not defined correctly.
We cannot execute /cygdrive/c/Program Files/Java/jdk1.7.0_01/bin/java
Any idea why it's not working? Java -version works fine, so it's not a problem with java. I've also tried jdk1.6.0 instead.
Running which java
gives,
$ which java
/cygdrive/c/windows/system32/java
and java -version
gives,
$ java -version
java version "1.7.0_01"
Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
Java HotSpot(TM) Client VM (build 21.1-b02, mixed mode, sharing)
If I run mvn.bat
instead of mvn
, I didn't have this problem.
So, since Cygwin will run the mvn file, I replaced this mvn file with a softlink (ln -s mvn.bat mvn
) to the batch file. This way, running mvn
will silently run the mvn.bat
which handles these problems gracefully.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With