Issue
Ubuntu 16.04.1 LTS
I have installed java by sudo apt-get install default-jdk
$ java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~16.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
$ which java
/usr/bin/java
and in /home/hadoop/hadoop-3.3.1/etc/hadoop/hadoop-env.sh, I have added
export JAVA_HOME=/usr/bin/java
hadoop@ubuntu:~/hadoop$ bin/hadoop
ERROR: JAVA_HOME /usr/bin/java does not exist
anyone can help?
Solution
/usr/bin/java
is not a java home. A java home must be a folder (not a program) with a bin directory which contains java
, jps
, maybe javac
and so on. You must find your jre or jdk folder and set it as JAVA_HOME.
get ll /usr/bin/java
and it may be a symbolic link to your Java path. or do find /usr/lib/jvm/java-1.x.x-openjdk
to find your java home. The parent directory of Java program is your JAVA_HOME and must be set with export in hadoop-env.sh
.
Answered By - Majid Hajibaba
Answer Checked By - Marilyn (JavaFixing Volunteer)