Help installing on Ubuntu (Simple JDK issue ?)

So here's what I did -

  1. Put the contents of the Oracle JDK into /usr/lib/jvm/jdk1.7.0/
  2. ran these commands:

$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1

$ export JAVA_HOME=/usr/lib/jvm/jdk1.7.0/bin/java

$ echo $JAVA_HOME

Now here's the problem:
$ sh 1: eval: /usr/lib/jvm/jdk1.7.0/bin/java: not found

I can see that /usr/lib/jvm/jdk1.7.0/bin/java does appear to exist.

What am I doing wrong?


Comment actions Permalink

Hi there,

I'm not a Linux user so do not take my words for granted .. but if you look at .. you will see that "/bin/java" will be added to the JDK path automatically. So .. instead of providing full path to java executable you need to provide path to JDK home folder only. Please refer to

So try

$ export JAVA_HOME=/usr/lib/jvm/jdk1.7.0

instead of
$ export JAVA_HOME=/usr/lib/jvm/jdk1.7.0/bin/java
Comment actions Permalink

Well, that wasn't it exactly but thanks anyway.   I finally got it working by re-installing Oracle java using these instructions:

To get the environment variable to work I had to add it to my .bashrc file:

export JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre/bin/java


Please sign in to leave a comment.