Search code examples
javaubuntu-12.10

JDK not recognized after installation in Ubuntu 12.10


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 

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,