eclipse_2">eclipse
错误提示:
A Java Runtime Environment (JRE) or Java Development Kit (JDK)
must be available in order to run Eclipse. No Java virtual machine
was found after searching the following locations:
/opt/eclipse/jre/bin/java
java in your current PATH
先检查
ls /usr/lib/jvm # 检查是否解压缩
保证环境变量正确配置
cd ~
vim ~/.bashrc #vim不行那就vi
在这个文件的开头位置,添加如下几行内容:
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_162
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
source ~/.bashrc
java -version
正常输出
但如果这样设置了,运行eclipse时依然报错
A Java Runtime Environment (JRE) or Java Development Kit (JDK)
must be available in order to run Eclipse. No Java virtual machine
was found after searching the following locations:
/opt/eclipse/jre/bin/java
java in your current PATH
则需要手动设置eclipse安装目录下的/eclipse/eclipse.ini
sudo gedit /opt/eclipse/eclipse.ini
在-vmargs这一行之前添加以下两行内容:
-vm
/usr/lib/jvm/jdk1.8.0_162/bin/java
保存并重新启动eclipse
Hadoop
dblab@dblab-Vmware:/usr/local/hadoop$ ./sbin/start-dfs.sh
Starting namenodes on [localhost]
localhost: ERROR: JAVA_HOME is not set and could not be found.
Starting datanodes
localhost: ERROR: JAVA_HOME is not set and could not be found.
Starting secondary namenodes [dblab-Vmware]
dblab-Vmware: ERROR: JAVA_HOME is not set and could not be found.
首先保证环境变量正确设置,看上一段即可,这里不再赘述
解决办法:
- 找到 Hadoop 的配置文件目录:
- 一般位于 $HADOOP_HOME/etc/hadoop 目录下,进入该目录,找到 hadoop-env.sh 文件。
- 编辑 hadoop-env.sh 文件:
- 使用文本编辑器打开 hadoop-env.sh 文件,在文件中查找 JAVA_HOME 的设置部分,通常会有类似这样的注释引导你去设置:
# The java implementation to use.
# export JAVA_HOME=${JAVA_HOME}
可以去掉注释,并将其修改为你实际的 Java 安装路径,如下:
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_162