Cloudera - JAVA_HOME not set

假装没事ソ 提交于 2019-12-12 00:20:05

问题


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.


回答1:


I met the same problem, just add JAVA_HOME="directory_to_JDK" setting into the /etc/environment, and it works.




回答2:


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.



来源:https://stackoverflow.com/questions/14173024/cloudera-java-home-not-set

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!