Question

I did these steps without error:

  1. JDK path :

    Downloads/jdk-6u37-linux-x64.bin
    
  2. Commands in Terminal:

    mkdir Programs
    cd Programs
    bash ../Downloads/jdk-6u37-linux-x64.bin
    ln -s jdk-6u37-linux-x64 jdk
    
  3. Set JAVA_HOME and Path:

    I added the following lines to the end of the .bashrc file:

    export JAVA_HOME=$Home/Programs/jdk
    export PATH=:$JAVA_HOME/bin:$PATH
    

This is the result of executing the command echo $JAVA_HOME:

/Programs/jdk

This is the result of executing the command echo $PATH:

:/Programs/jdk/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games1

And the problem is:
This is the result of executing the command

$ java -version

The program 'java' can be found in the following packages:
 * default-jre
 * gcj-4.6-jre-headless
 * gcj-4.7-jre-headless
 * openjdk-7-jre-headless
 * openjdk-6-jre-headless
Try: sudo apt-get install 
Was it helpful?

Solution

I think the problem is that environment variables are case sensitive in linux, so your

export JAVA_HOME=$Home/Programs/jdk

Should be

export JAVA_HOME=$HOME/Programs/jdk

In your echo $JAVA_HOME output you can see that you don't get your /home/yourname prepended...

Hope that helps.

Cheers,

OTHER TIPS

The scripts located here will help you install sun's jdk on Ubuntu. Really useful stuff.

try this command

sudo update-alternatives --config java

This will list all the Java versions installed and configured.

If you see one or more installs, it will give you a list each element starting with a number. Just choose the number that corresponds to the version you want to use by default.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top