Error: JAVA_HOME is not set and could not be found after hadoop installation
Let's edit /etc/hadoop/hadoop-env.sh file and set JAVA_HOME
for Hadoop. It is the path on which you didn't find hadoop-env.sh
.
Open the file and find the line as bellow
export JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/
If the line exists and is commented out, do uncomment. Otherwise, add the line into the file. Beware not
export JAVA_HOME=${JAVA_HOME}
If the file is still not found, maybe path is different. Try to search it using,
find / -iname 'hadoop-env.sh'
Hadoop on Windows - Error JAVA_HOME is incorrectly set.
If your JAVA_HOME path contains spaces, you must use the Windows 8.3 Pathname
Hadoop: JAVA_HOME is not set
Thank you @Chris Shain and @Chris White for your hints. I was running hadoop as su, and su doesn't automatically know about the environmental variables I set. I logged in as my hadoop user (I had chown'd the hadoop install directory to this user), and was able to format the hdfs.
Secondary problem: When I tried to start Hadoop, NameNode and JobTracker started successfully but DataNode, SecondaryNameNode, and TaskTracker failed to start. I dug in a little bit. NameNode and JobTracker are started via hadoop-daemon.sh, but DataNode, SecondaryNameNode, and TaskTracker are started by hadoop-daemon*s*.sh. The resolution here was to properly set JAVA_HOME in conf/hadoop-env.sh.
run hadoop ERROR: JAVA_HOME /usr/bin/java does not exist
/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
.
getting JAVA_HOME is incorrectly set with hadoop
Your JAVA_HOME
should not include bin
. Change it from
"C:\Program Files\Java\jdk1.8.0_45\bin"
to
"C:\Program Files\Java\jdk1.8.0_45"
And you can add it to your path (in Windows) like
set "PATH=%PATH%;%JAVA_HOME%\bin"
JAVA_HOME is set incorrectly -- Hadoop on Windows 10
JAVA_HOME should be point to the root directory of a Java JDK and should be specified in the environment variables. After setting this value a restart of the terminal/application/console/IDE/command-prompt is required to make the new value active.
If you simple give: java --version
it use the first java.exe version found on your PATH. JAVA_HOME and the PATH java version don't have any relation with each other.
JAVA_HOME can be specified for example to: "c:/java/jdk9" and your path includes "c:/java/jdk8/bin". In this situation java --version
will give you 1.8.x.x
.
JAVA_HOME is used by processes that forks to a new subproces and then used that JAVA_HOME value.
In your situation there is probably only a spacer missing in/after the call to hadoop-env.cmd ?? (not clear with the current info)
Related Topics
How to Imshow with Invisible Figure in Matlab Running on Linux
Why Can Back-Quotes and $() for Command Substitution Result in Different Output
Convert an Iso Date to Seconds Since Epoch in Linux Bash
How to Run Script Commands from Variables
How to Pass Command Line Parameters from a File
Shell Prompt That Is Based on Location in Filesystem
Assigning Dynamic Bash Variable Names Using a for Loop Seq
What's the Difference Between ./Script.Sh and Bash Script.Sh
How to Set Process Group of a Shell Script
Bash 'Swallowing' Sub-Shell Children Process When Executing a Single Command
Write-Only Mapping a O_Wronly Opened File Supposed to Work
Platform Independent Resource Management
Can't Run Executable Linked with Libc
Linux/Gcc: Ldd Functionality from Inside a C/C++ Program
Aws-Ec2, How to Set Multiple Public Sites with Just One Instance