Adding JAVA_HOME (JDK) in .bashrc

First, you have a typo in export line. It should be

export PATH=$PATH:$JAVA_HOME/bin

No space, add a $ character before JAVA_HOME, add /bin

However fixing above line may not fix your problem in installing java. The easiest way to install java is by using webup8 ppa:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

After the last command, the script will automatically download the jdk from Oracle website and install it for you. You can read the tutorial here.


You have set the environment variable JAVA_HOME, but this is only a value used by applications that want to know where the JRE or JDK are.

The PATH is what your shell is looking in when you try to run executables. So when you type java -version, it is looking in the JDK folder. Note that java is actually inside $JAVA_HOME/bin. That's why it can't find it.

That's the explanation.

The fix is to either add it to the $PATH properly:

export PATH=$PATH:JAVA_HOME/bin

or to run update-alternatives and add the JDK path to the system's java alternatives.

For example

update-alternatives --install "/usr/bin/java" "java" "/home/myuser/sandbox/java/7u55/jdk1.7.0_55/bin/java" 3

Sqoop not finding jdk thats why this error coming. By default jre used and it don't have javac file which is required to compile sqoop jobs.

Solution:

if jdk installed on the system then configure the same in hadoop-env.sh file like:

# The java implementation to use.  Required.
export JAVA_HOME=/opt/jdk1.8.0_151/

And in .bash_profile file.

like:

PATH=$PATH:$HOME/.local/bin:$HOME/bin:/opt/jdk1.8.0_151/bin

then run source . .bash_profile

thats it now test sqoop job will works fine.