Note
These instructions are specifically for Debian 5.0 to 6.0 - they may not be appropriate for other distributions or other versions of Debian.
Instructions
Obtain a Debian Package of the Oracle JVM
Use java-package to create a Debian package. See the article Creating a Debian Package of the Oracle Java SDK for instructions.
Transfer the package file, e.g. oracle-j2sdk1.7_1.7.0+update17_amd64.deb, to the machine you want to install Java 7 on.
Install Package
As root:
dpkg -i oracle-j2sdk1.7_1.7.0+update17_amd64.deb
Set installed version of Java as the default:
root@squeezevm:~# update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/bin/gij-4.4 1044 manual mode
2 /usr/lib/jvm/j2sdk1.7-oracle/jre/bin/java 317 manual mode
3 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/j2sdk1.7-oracle/jre/bin/java to provide /usr/bin/java (java) in manual mode.
root@squeezevm:~# # Check that the default java is the one that we chose
root@squeezevm:~# java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
Configure Tomcat to use the new version of Java
Edit /etc/default/tomcat5.5 and set JAVA_HOME to point at the new version of Java, for example:
JAVA_HOME=/usr/lib/jvm/j2sdk1.7-oracle
Restart Tomcat:
/etc/init.d/tomcat5.5 restart
Check that Tomcat is using the new version - go to /manager/html and look at the 'JVM Version' in the 'Server Information' table at the bottom of the page.
Uninstall old versions
At this point you may remove the old Java packages with 'apt-get remove <package>' or 'dpkg -r <package>'. To find out the package name of the old version run 'dpkg -S' on its directory in /usr/lib/jvm, for example:
dpkg -S /usr/lib/jvm/java-1.5.0-sun-1.5.0.22
Comments
0 comments
Please sign in to leave a comment.