export JAVA_HOME with spaces in Cygwin

后端 未结 7 943
失恋的感觉
失恋的感觉 2020-12-19 01:47

I\'m trying to set my JAVA_HOME in Cygwin with this command:

export JAVA_HOME=\"/cygdrive/c/Program Files/Java/jdk1.7.0_10\"

But when I do

7条回答
  •  爱一瞬间的悲伤
    2020-12-19 02:29

    I faced this problem too and I saw many posts but nothing really worked. There is a small trick that I did and things started working.

    My JAVA_HOME was set to C:/Program Files/Java/jdk1.7.0_23. The problem was with Program Files directory and I was getting the same error.

    In Windows there is a short name created for every directory with a space which is without a space. You can see it by running dir /X command on the command prompt. The Short name for Program Files was PROGRA~1.

    In the Windows env variable through My Computer I changed the JAVA_HOME to C:/PROGR~1/Java/jdk1.7.0_23 and in hadoop-env.sh I changed JAVA_HOME to /cygdrv/c/PROGRA~1/Java/jdk1.7.0_23.

    It worked fine.

提交回复
热议问题