I just installed Ubuntu and am Java 7u55 (JDK) and am trying to configure JAVA_HOME as an environment variable.

In ~/.bashrc I added:

# Exports

Yet when I close the terminal and open a new shell and type which java or java -version Ubuntu doesn't seem to know what I'm talking about (says program java can be found in one of several packages and prompts me to use sudo apt-get to install one of them).

What am I doing wrong?


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.

| improve this answer | |

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:


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
| improve this answer | |

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.


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.



then run source . .bash_profile

thats it now test sqoop job will works fine.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.