Linux中的刚性设置JAVA_HOME变量[重复]

时间:2022-06-13 10:57:25

This question already has an answer here:

这个问题在这里已有答案:

I'm trying to run all hadoop daemons with the command

我正在尝试使用该命令运行所有hadoop守护进程

./start-all.sh

from the main host cluster. As a result of execution several times gave out

来自主要主机群集。由于执行多次给出

starting namenode, logging to /export/hadoop-1.0.1/libexec/../logs/hadoop--namenode-one.out
192.168.1.10: starting datanode, logging to /export/hadoop-1.0.1/libexec/../logs/hadoop-hadoop-datanode-myhost2.out
192.168.1.10: Error: JAVA_HOME is not set.

And it happened several times even after execution on the virtual machine to the address of 192.168.1.10 commands

即使在虚拟机上执行192.168.1.10命令的地址后,它也发生了几次

hadoop@myhost2:~$ export JAVA_HOME=/opt/jdk1.7.0_06

Tell please how rigidly once and for all to fix the JAVA_HOME variable.

请一劳永逸地告诉JAVA_HOME变量。

3 个解决方案

#1


1  

Put the line export JAVA_HOME=/path/to/java at the beginning of your start-all.sh script, and that should do it.

将行导出JAVA_HOME = / path /到/ java放在start-all.sh脚本的开头,应该这样做。

#2


1  

$ vi ~/.bash_proflle

$ vi~ / .bash_proflle

append this line to the file

将此行追加到文件中

export JAVA_HOME=/opt/jdk1.7.0_06

export JAVA_HOME = / opt / jdk1.7.0_06

that will make permanent changes to JAVA_HOME environment variable.

这会对JAVA_HOME环境变量进行永久性更改。

#3


1  

You shoud set JAVA_HOME in hadoop-env.sh file also. Which is in $HADOOP_INSTALL/hadoop/conf directory of hadoop. by default JAVA_HOME setting line is commented

你也应该在hadoop-env.sh文件中设置JAVA_HOME。这是在hadoop的$ HADOOP_INSTALL / hadoop / conf目录中。默认情况下,JAVA_HOME设置行被注释

hadoop-env.sh - This file contains some environment variable settings used by Hadoop. You can use these to affect some aspects of Hadoop daemon behavior, such as where log files are stored, the maximum amount of heap used etc. The only variable you should need to change in this file is JAVA_HOME

hadoop-env.sh - 此文件包含Hadoop使用的一些环境变量设置。您可以使用这些来影响Hadoop守护程序行为的某些方面,例如存储日志文件的位置,使用的最大堆数等。您应该在此文件中更改的唯一变量是JAVA_HOME

Or You can add it in following file in hadoop account.

或者您可以将其添加到hadoop帐户的以下文件中。

~/.bash_proflle

#1


1  

Put the line export JAVA_HOME=/path/to/java at the beginning of your start-all.sh script, and that should do it.

将行导出JAVA_HOME = / path /到/ java放在start-all.sh脚本的开头,应该这样做。

#2


1  

$ vi ~/.bash_proflle

$ vi~ / .bash_proflle

append this line to the file

将此行追加到文件中

export JAVA_HOME=/opt/jdk1.7.0_06

export JAVA_HOME = / opt / jdk1.7.0_06

that will make permanent changes to JAVA_HOME environment variable.

这会对JAVA_HOME环境变量进行永久性更改。

#3


1  

You shoud set JAVA_HOME in hadoop-env.sh file also. Which is in $HADOOP_INSTALL/hadoop/conf directory of hadoop. by default JAVA_HOME setting line is commented

你也应该在hadoop-env.sh文件中设置JAVA_HOME。这是在hadoop的$ HADOOP_INSTALL / hadoop / conf目录中。默认情况下,JAVA_HOME设置行被注释

hadoop-env.sh - This file contains some environment variable settings used by Hadoop. You can use these to affect some aspects of Hadoop daemon behavior, such as where log files are stored, the maximum amount of heap used etc. The only variable you should need to change in this file is JAVA_HOME

hadoop-env.sh - 此文件包含Hadoop使用的一些环境变量设置。您可以使用这些来影响Hadoop守护程序行为的某些方面,例如存储日志文件的位置,使用的最大堆数等。您应该在此文件中更改的唯一变量是JAVA_HOME

Or You can add it in following file in hadoop account.

或者您可以将其添加到hadoop帐户的以下文件中。

~/.bash_proflle