我正在尝试在 Hadoop 的 env.sh 中设置 JAVA_HOME。我在 Windows 7 上使用 Cygwin。我将 env.sh 编辑为:
export JAVA_HOME= "/cygdrive/C/Program Files/Java/jdk1.6.0_26"
在环境变量中,我将 JAVA_HOME 设置为 C:\Program Files\Java\jdk1.6.0_26。
和路径一样%JAVA_HOME%\bin;c:\cygwin\bin;c:\cygwin\usr\sbin
。
但我仍然收到这些错误:
/cygdrive/d/hadoop-1.2.1/libexec/../conf/hadoop-env.sh: line 2: $'\r': command not found
/cygdrive/d/hadoop-1.2.1/libexec/../conf/hadoop-env.sh: line 7: $'\r': command not found
': not a valid identifierlibexec/../conf/hadoop-env.sh: line 9: export:
`/cygdrive/C/Program Files/Java/jdk1.6.0_26
/cygdrive/d/hadoop-1.2.1/libexec/../conf/hadoop-env.sh: line 12: $'\r': command not found
/cygdrive/d/hadoop-1.2.1/libexec/../conf/hadoop-env.sh: line 41: $'\r': command not found
/cygdrive/d/hadoop-1.2.1/libexec/../conf/hadoop-env.sh: line 46: $'\r': command not found
/cygdrive/d/hadoop-1.2.1/libexec/../conf/hadoop-env.sh: line 52: $'\r': command not found
/cygdrive/d/hadoop-1.2.1/libexec/../conf/hadoop-env.sh: line 55: $'\r': command not found
Error: JAVA_HOME is not set.
当我在做 echo $JAVA_HOME 时,它给出了 C:\Program Files\Java\jdk1.6.0_26。我已经在这个网站上检查了所有可能的内容,但仍然面临问题。