简体   繁体   中英

Cloudera - JAVA_HOME not set

I am pretty novice when it comes to Ubuntu but I am trying to follow along with the install instructions for Cloudera located here .

At step 1, I am getting to following error:

brock@brock-hpserver:~$ sudo -u hdfs hdfs namenode -format
Error: JAVA_HOME is not set and could not be found.

However, although I could be wrong, I believe I have everything set up properly:

brock@brock-hpserver:~$ echo $JAVA_HOME
/usr/lib/jvm/java-6-openjdk-amd64
brock@brock-hpserver:~$ echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:JAVA_HOME/bin

And finally my java version:

brock@brock-hpserver:~$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-0ubuntu1~12.04.1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

Any help will be greatly appreciated. I simply just want to poke around and learn Hadoop on a spare machine at home.

我遇到了同样的问题,只需将JAVA_HOME="directory_to_JDK"设置添加到/etc/environment ,它就可以工作。

The JAVA_HOME is defined for your process, but not for the process in which the sudo is running. export the JAVA_HOME definition. I don't recall the syntax, but I believe it's similar to export JAVA_HOME=/drive/dir1/dir2/java

If that does not work, JAVA_HOME can be defined at the system level, for all processes. It's been a long time, I don't recall how. But hopefully there's enough here to allow you to Google.

Here's a SO link about export.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM