0

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 
jokerdino
  • 2,047
  • 1
  • 25
  • 31
HFDev
  • 131
  • 2
  • 4
  • 11

3 Answers3

1

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,

Anders R. Bystrup
  • 15,729
  • 10
  • 59
  • 55
1

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

BillRobertson42
  • 12,602
  • 4
  • 40
  • 57
  • Is this just a software repository for easier Download and access to the JDK? Do I understand correctly? – HFDev Nov 09 '12 at 13:53
  • The scripts download the jdk from Sun, then they do some apt magic to package them for apt, then you just run an apt upgrade (or update?) and it will set them up for you. Good stuff. – BillRobertson42 Nov 12 '12 at 07:12
0

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.

Milan
  • 53
  • 6