无法使用cygwin为hadoop设置JAVA_HOME

时间:2013-09-27 20:08:16

标签: hadoop cygwin java-home

我正在尝试在hadoop的JAVA_HOME中设置env.sh。我在Windows 7上使用cygwin。 我已将env.sh编辑为:

export JAVA_HOME= "/cygdrive/C/Program Files/Java/jdk1.6.0_26"

在环境变量中,我将JAVA_HOM E设为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.

我已经检查了本网站上的所有可能但仍然面临问题。

2 个答案:

答案 0 :(得分:1)

使用

 export JAVA_HOME="C:/PROGRA~2/Java/jdk1.6.0_03"  
#for 32位Java arch

使用
  export  export JAVA_HOME="C:/PROGRA~1/Java/jdk1.6.0_03" 
#for 64位Java arch

这将解决你的问题......我给出的答案很晚,但它会帮助初学者面临同样的问题。

答案 1 :(得分:0)

使用C:\“Program Files”\ Java \ jdk1.6.0_26代替,这应解决java问题。