How I Install Sun Java Jdk on Ubuntu Linux
Oracle’s licensing debacle is annoying, and I would love to ditch the Sun JVM. But, nothing out there is 100% compatible and free.
Install Sun java JDK in /usr/java manually Unfortunately, Sun doesn’t have a good url for wget/curl’ing, so you have to manually download the self-extracting Linux installer. Current version is 1.6.25, and is here http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-download-346242.html You should be getting the x64 version (there is no good reason to run a 32-bit OS unless you are on a very old, or embedded, computer) The current file is jdk-6u25-linux-x64.bin Put this on your server and run it chmod uog+x jdk-6u25-linux-x64.bin; ./jdk-6u25-linux-x64.bin then move the directory to /usr/
I like to leave the full version on the directory, and sym link it to /usr/java
cd /usr/
ln -s jdk1.6.XXX java
chown -R root:root jdk*
chown -R root:root java*
Setup system JAVA_HOME and add /usr/java/bin to the default PATH
echo 'declare -x JAVA_HOME="/usr/java"' | sudo tee -a /etc/bash.bashrc
echo 'declare -x PATH="${PATH}:${JAVA_HOME}/bin"' | sudo tee -a /etc/bash.bashrc
Ubuntu’s update-alternatives crap will prevent accidental install of OpenJDK
sudo update-alternatives --install /usr/bin/java java /usr/java/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/java/bin/javac 1
sudo update-alternatives --install /usr/bin/itweb-settings itweb-settings /usr/java/bin/itweb-settings 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/java/bin/javaws 1
sudo update-alternatives --install /usr/bin/jexec jexec /usr/java/bin/jexec 1
sudo update-alternatives --install /usr/bin/jexec-binfmt jexec-binfmt /usr/java/bin/jexec-binfmt 1
sudo update-alternatives --install /usr/bin/keytool keytool /usr/java/bin/keytool 1
sudo update-alternatives --install /usr/bin/orbd orbd /usr/java/bin/orbd 1
sudo update-alternatives --install /usr/bin/pack200 pack200 /usr/java/bin/pack200 1
sudo update-alternatives --install /usr/bin/policytool policytool /usr/java/bin/policytool 1
sudo update-alternatives --install /usr/bin/rmid rmid /usr/java/bin/rmid 1
sudo update-alternatives --install /usr/bin/rmiregistry rmiregistry /usr/java/bin/rmiregistry 1
sudo update-alternatives --install /usr/bin/servertool servertool /usr/java/bin/servertool 1
sudo update-alternatives --install /usr/bin/tnameserv tnameserv /usr/java/bin/tnameserv 1
sudo update-alternatives --install /usr/bin/unpack200 unpack200 /usr/java/bin/unpack200 1
Confirm the version is installed with
java -version
which java
Good luck. I can’t wait for OpenJDK to deprecate Sun JDK!
Archives