Hadoop:«错误:未设置JAVA_HOME» [英] Hadoop: «ERROR : JAVA_HOME is not set»

查看:158
本文介绍了Hadoop:«错误:未设置JAVA_HOME»的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Ubuntu 11.10上安装Hadoop。我将文件 conf / hadoop-env.sh 中的 JAVA_HOME 变量设置为:

 #export JAVA_HOME = / usr / lib / jvm / java-1.6.0 -b openjdk 

$ b

然后我执行这些命令(独立操作):

  $ mkdir输入
$ cp conf / *。xml输入
$ bin / hadoop jar hadoop-examples - *。jar grep输入输出'dfs [az。] +'
$ cat output / *

但执行第三个命令时出现以下错误:


错误:未设置JAVA_HOME

JAVA_HOME 变量设置不正确?

解决方案

确保您已经删除了评论标签并更改了您的 JAVA_HOME hadoop-env.sh 以及相应的 .bashrc 和/或 .profile

 #export JAVA_HOME = / usr / lib中/ J vm / java-1.6.0-openjdk 

应该是

  export JAVA_HOME = / usr / lib / jvm / java-1.6.0 -openjdk 

您可以为所有用户设置您的 JAVA_HOME PATH / etc / profile 中。



另外,不要将它设置为错误的路径忘记通过注销/ in或通过执行 source / etc / profile 激活新更改。


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:

ERROR : JAVA_HOME is not set

Is the JAVA_HOME variable not set correctly?

解决方案

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

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.

Also, don't forget to activate the new change by logging-out/in or by executing source /etc/profile.

这篇关于Hadoop:«错误:未设置JAVA_HOME»的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆