Rachel
Rachel

Reputation: 103397

Cygwin: Unable to find Java path.

I am using cygwin on windows 7 env and it is unable to locate java, error message i get is that

ERROR: /cygdrive/c/Program
Files/Java/jdk1.6.0_22 does not exist!

wired path is if I do echo $JAVA_HOME then it shows me

$ echo $JAVA_HOME
/cygdrive/c/Program Files/Java/jdk1.6.0_22

not sure what is happening here, any suggestions?

Upvotes: 2

Views: 5098

Answers (2)

tammuz
tammuz

Reputation: 407

Use the old school way:

export JAVA_HOME=/cygdrive/c/Progra~1/Java/jdk1.6.0_22

It worked for me.

Upvotes: 4

Luke Girvin
Luke Girvin

Reputation: 13432

The problem is that the pathname contains spaces. You need to escape the spaces as described here:

http://www.cygwin.com/faq/faq.using.html#faq.using.filename-spaces

Adding this line to your .bashrc should do it:

export JAVA_HOME='/cygdrive/c/Program Files/Java/jdk1.6.0_22'

Edit: You could try running this script which I found in this blog post:

case "`uname`" in
  CYGWIN*) cygwin=true ;;

esac

# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
  JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
  CLASSPATH=`cygpath --windows --path "$CLASSPATH"`
fi

Upvotes: 4

Related Questions