Unfortunately, Oracle (Sun) only provides rpm installer packages or tar.gz packed binaries. There’s also no pp archive, or at least i could not find one. That is why I wrote the following tutorial on how to install the Sun JDK7 under Ubuntu. (It’s not the cleanest way, but it is definitely okay to set it up it like that).
More for more
p.s. This will work in any Ubuntu since 9.04
This tutorial assumes you have a default set up under /usr/lib/jvm. Think when you are following the next steps, change paths accordingly to your downloaded archive / jdk version and path of jvm installations.
- Download the SDK7 (google “jdk7 download”) as a tar.gz file.
- Unpack it (tar -xzvf jdk-7-linux-xxxx.tar.gz)
- Move the extracted folder (currently most probably called jdk1.7.0) to /usr/lib/jvm/jdk1.7.0 (sudo mv jdk1.7.0 /usr/lib/jvm/)
- Check how many java runtime and devkit installations you already have installed using update-alternatives
- sudo update-alternatives –config java <- check the highest number available for selection, for example 3 (This would mean we have 4 installed, alternative slots 0,1,2 and 3 are already taken)
- Remember this number +1 and let’s call it our magic number. This is the position we will put our alternative to. In this example: 4
- Hit enter to leave without touching the alternative configuration
- Now, we add the new alternative with the following command. replace the ’4′ with your magic number from the last step
- sudo update-alternatives –install /usr/bin/java java /usr/lib/jvm/jdk1.7.0/jre/bin/java 4
- Now we select our alternative, so again: sudo update-alternatives –config java
- Select 4 (or whatever your magic number was…)
Enjoy the newest java runtime!