Hadoop:«错误:JAVA_HOME 未设置» [英] Hadoop: «ERROR : JAVA_HOME is not set»
问题描述
我正在尝试在 Ubuntu 11.10 上安装 Hadoop.我将文件 conf/hadoop-env.sh
中的 JAVA_HOME
变量设置为:
I'm trying to install Hadoop on Ubuntu 11.10. I set the JAVA_HOME
variable in the file conf/hadoop-env.sh
to:
# 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:
错误:JAVA_HOME 未设置
ERROR : JAVA_HOME is not set
JAVA_HOME
变量是否设置不正确?
Is the JAVA_HOME
variable not set correctly?
推荐答案
请确保您已删除 hadoop-env.sh
JAVA_HOME> 以及适当的 .bashrc
和/或 .profile
:
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
:
# export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
应该是
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
您可以在 /etc/profile 中为所有用户设置您的
.JAVA_HOME
和 PATH
(确保您之前没有将其设置为错误的路径)
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
.
另外,不要忘记通过注销/登录或执行source/etc/profile
来激活新的更改.
Also, don't forget to activate the new change by logging-out/in or by executing source /etc/profile
.
这篇关于Hadoop:«错误:JAVA_HOME 未设置»的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!