I'm trying to install Hadoop on Ubuntu 11.10. I set the JAVA_HOME
variable in the file conf/hadoop-env.sh
to:
我正在尝试在Ubuntu 11.10上安装Hadoop。我在文件conf/hadoop-env中设置了JAVA_HOME变量。承宪:
# export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
and then I execute these commands (Standalone Operation):
然后执行这些命令(独立操作):
$ mkdir input
$ cp conf/*.xml input
$ bin/hadoop jar hadoop-examples-*.jar grep input output 'dfs[a-z.]+'
$ cat output/*
but I have the following error when executing the third command:
但是在执行第三个命令时,我有以下错误:
ERROR : JAVA_HOME is not set
错误:没有设置JAVA_HOME
Is the JAVA_HOME
variable not set correctly?
JAVA_HOME变量没有正确设置吗?
7 个解决方案
#1
43
Make sure that you have removed the comment tag and changed your JAVA_HOME
in the hadoop-env.sh
as well as the appropriate .bashrc
and/or .profile
:
确保您已经删除了注释标记并更改了hadoop-env中的JAVA_HOME。以及适当的。bashrc和/或.profile:
# export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
should be
应该是
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
You can set your JAVA_HOME
and PATH
for all users (make sure you haven't previously set this to the wrong path) in /etc/profile
.
您可以在/etc/ profilefile中为所有用户设置JAVA_HOME和路径(请确保之前没有将其设置为错误的路径)。
Also, don't forget to activate the new change by logging-out/in or by executing source /etc/profile
.
另外,不要忘记通过登录/进入或执行源/etc/ profilefile来激活新的更改。
#2
24
You should set JAVA_HOME
in the hadoop-env.sh
file also which is in the Hadoop configuration directory. By default the JAVA_HOME
setting line is commented.
您应该在hadoop-env中设置JAVA_HOME。文件也在Hadoop配置目录中。默认情况下,将注释JAVA_HOME设置行。
#3
10
Type echo $JAVA_HOME
in your terminal to be sure your JAVA_HOME
is set.
在终端中键入echo $JAVA_HOME以确保您的JAVA_HOME已设置。
You can also type java -version
to know what version of java you are actually using.
您还可以输入java -version来了解实际使用的java版本。
By the way, reading your description it seems your actually writing
顺便说一下,阅读你的描述,你似乎真的在写
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
in the file conf/hadoop-env.sh
, you should write it in your terminal or in ~/.bashrc
or ~/.profile
then type source < path to modified file >
.
在文件conf / hadoop-env。sh,你应该把它写在你的终端或~/。bashrc或(~ /。然后输入源文件 <路径到修改后的文件> 。
#4
6
You can add in your .bashrc
file:
您可以在.bashrc文件中添加:
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
and it will dynamically change when you update your packages.
当你更新你的包时,它会动态变化。
#5
1
Copy this export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
to hadoop-env.sh
file.
将这个导出JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk复制到hadoop-env。sh文件。
JAVA_HOME
is the location where java binaries are present.
JAVA_HOME是存在java二进制文件的位置。
#6
0
I tried the above solutions but the following worked on me
我尝试了以上的解决方案,但是下面的方法对我起了作用
export JAVA_HOME=/usr/java/default
#7
-7
- hadoop ERROR : JAVA_HOME is not set
- hadoop错误:没有设置JAVA_HOME
Above error is because of the space in between two words.
上面的错误是由于两个单词之间的空格。
Eg: Java located in C:\Program Files\Java --> Space in between Program and files would cause the above problem. If you remove the space, it would not show any error.
如:Java位于C:\Program Files\Java - - >程序和文件之间的空间会导致上述问题。如果您删除空格,它将不会显示任何错误。
#1
43
Make sure that you have removed the comment tag and changed your JAVA_HOME
in the hadoop-env.sh
as well as the appropriate .bashrc
and/or .profile
:
确保您已经删除了注释标记并更改了hadoop-env中的JAVA_HOME。以及适当的。bashrc和/或.profile:
# export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
should be
应该是
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
You can set your JAVA_HOME
and PATH
for all users (make sure you haven't previously set this to the wrong path) in /etc/profile
.
您可以在/etc/ profilefile中为所有用户设置JAVA_HOME和路径(请确保之前没有将其设置为错误的路径)。
Also, don't forget to activate the new change by logging-out/in or by executing source /etc/profile
.
另外,不要忘记通过登录/进入或执行源/etc/ profilefile来激活新的更改。
#2
24
You should set JAVA_HOME
in the hadoop-env.sh
file also which is in the Hadoop configuration directory. By default the JAVA_HOME
setting line is commented.
您应该在hadoop-env中设置JAVA_HOME。文件也在Hadoop配置目录中。默认情况下,将注释JAVA_HOME设置行。
#3
10
Type echo $JAVA_HOME
in your terminal to be sure your JAVA_HOME
is set.
在终端中键入echo $JAVA_HOME以确保您的JAVA_HOME已设置。
You can also type java -version
to know what version of java you are actually using.
您还可以输入java -version来了解实际使用的java版本。
By the way, reading your description it seems your actually writing
顺便说一下,阅读你的描述,你似乎真的在写
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
in the file conf/hadoop-env.sh
, you should write it in your terminal or in ~/.bashrc
or ~/.profile
then type source < path to modified file >
.
在文件conf / hadoop-env。sh,你应该把它写在你的终端或~/。bashrc或(~ /。然后输入源文件 <路径到修改后的文件> 。
#4
6
You can add in your .bashrc
file:
您可以在.bashrc文件中添加:
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
and it will dynamically change when you update your packages.
当你更新你的包时,它会动态变化。
#5
1
Copy this export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
to hadoop-env.sh
file.
将这个导出JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk复制到hadoop-env。sh文件。
JAVA_HOME
is the location where java binaries are present.
JAVA_HOME是存在java二进制文件的位置。
#6
0
I tried the above solutions but the following worked on me
我尝试了以上的解决方案,但是下面的方法对我起了作用
export JAVA_HOME=/usr/java/default
#7
-7
- hadoop ERROR : JAVA_HOME is not set
- hadoop错误:没有设置JAVA_HOME
Above error is because of the space in between two words.
上面的错误是由于两个单词之间的空格。
Eg: Java located in C:\Program Files\Java --> Space in between Program and files would cause the above problem. If you remove the space, it would not show any error.
如:Java位于C:\Program Files\Java - - >程序和文件之间的空间会导致上述问题。如果您删除空格,它将不会显示任何错误。