Manually install Sun Java on Debian

Wed, Dec 26, 2012 One-minute read

This is a tutorial on how to manually install Sun Java on Debian Linux. This may also work for other distributions but I cannot guarantee that.

cd /usr/lib
mkdir jvm
cd jvm

Download the latest .tar.gz file from http://www.java.com/de/download/manual.jsp and put in in the jvm directory.

tar -xvzf javafile.tar.gz

Now set the alternatives path. If you’re just installing the runtime environment, you only need the first line.

update-alternatives –install “/usr/bin/java” java “/usr/lib/jvm/TheExtractedFolder/bin/java” 1
update-alternatives –install “/usr/bin/javac” javac “/usr/lib/jvm/TheExtractedFolder/bin/javac” 1
update-alternatives –install “/usr/bin/javaws” javaws “/usr/lib/jvm/TheExtractedFolder/bin/javaws” 1

The last thing you have to do is to set the environment variables.

vi /etc/profile

Add the following two lines at the end:

JAVA_HOME="/usr/lib/jvm/TheExtractedFolder
export JAVA_HOME

Now activate it:

source /etc/profile

That’s it.

 

To test if everything works, execute the following commands:

echo $JAVA_HOME
java -version