Venus
Venus

Reputation: 1312

run hadoop ERROR: JAVA_HOME /usr/bin/java does not exist

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?

Upvotes: 1

Views: 6204

Answers (4)

Jairo Ceron
Jairo Ceron

Reputation: 17

I used the command:

export JAVA_HOME=/usr/lib/jvm/java-11-amazon-corretto

enter image description here

enter image description here

Upvotes: 0

Phil Jay
Phil Jay

Reputation: 1

you could run readlink -f $(which java) command which returns the actual path to the target file.

This will give you an output like this

readlink -f $(which java)                                                                                                                                                                                  
/usr/lib/jvm/java-11-openjdk-amd64/bin/java

Upvotes: 0

Jaikish Pai
Jaikish Pai

Reputation: 29

I could not run it with Java 11 installed so i installed Java 8 and tried this : /usr/lib/jvm/java-8-openjdk-amd64/jre/bin and it worked fine.

Upvotes: 0

Majid Hajibaba
Majid Hajibaba

Reputation: 3260

/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.

Upvotes: 5

Related Questions