0

I need to install Java 5 in my Ubuntu 12.04. Can't do it by apt-get anymore.

Downloaded the .bin from http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase5-419410.html and installed it.

Still, the option for jdk 1.5 doesn't appear after I do: sudo update-alternatives --config java

What am I doing wrong? How should I do it?

Thanks.

1 Answers1

1

Looks like you got it wrong.

For using update-alternatives you have to inform it that you got a new java version:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre1.7.0_40/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_40/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jre1.7.0_40/bin/javaws" 1

And set that version as the default one:

sudo update-alternatives --set java /usr/local/java/jre1.7.0_40/bin/java
sudo update-alternatives --set javac /usr/local/java/jdk1.7.0_40/bin/javac
sudo update-alternatives --set javaws /usr/local/java/jre1.7.0_40/bin/javaws

Also, you may want to edit you /etc/profile to add java to the PATH, although maybe the Oracle installer already did that for you.

Mikel Pascual
  • 2,202
  • 18
  • 27