Every time I have to install a new Debian system I end up going to half a dozen pages to find all the steps needed to add Java to the system. I usually want to have both Suns JDK and OpenJDK install so that I can switch between them. So here is how to go about installing them.
To install Suns JDK the contrib and non-free repositories to apt. To do this edit /etc/apt/sources.list and add contib non-free to the end of both deb and deb-src ftp repositories. When done the lines should look something like this:
deb http://ftp.dk.debian.org/debian/ lenny main contrib non-free
deb-src http://ftp.dk.debian.org/debian/ lenny main contrib non-free
Now run apt-get update to refresh the package list.
Next we will install Suns JDK. Run the command:
apt-get install sun-java6-jdk
Follow the instructions on screen.
Next we need to install Open JDK. Run the command:
apt-get install openjdk-6-jdk
Next we need to make sure that the correct JDK is chosen by default when running java. This is done using update-alternatives command. Run the command:
update-alternatives --config java
Select the version you want to run. It is useful to remember this command for when you want to change JVM implementation.
That’s it. Java is set up and ready to be used.
Every time I have to install a new Debian system I end up going to half a dozen pages to find all the steps needed to add Java to the system. I usually want to have both Suns JDK and OpenJDK install so that I can switch between them. So here is how to go about installing them.
To install Suns JDK the contrib and non-free repositories to apt. To do this edit /etc/apt/sources.list and add contib non-free to the end of both deb and deb-src ftp repositories. When done the lines should look something like this:
deb http://ftp.dk.debian.org/debian/ lenny main contrib non-free
deb-src http://ftp.dk.debian.org/debian/ lenny main contrib non-free
Now run apt-get update to refresh the package list.
Next we will install Suns JDK. Run the command:
apt-get install sun-java6-jdk
Follow the instructions on screen.
Next we need to install Open JDK. Run the command:
apt-get install openjdk-6-jdk
Next we need to make sure that the correct JDK is chosen by default when running java. This is done using update-alternatives command. Run the command:
update-alternatives --config java
Select the version you want to run. It is useful to remember this command for when you want to change JVM implementation.
That's it. Java is set up and ready to be used.