In the evening I installed the Oracle Java JDK on Ubuntu Lucid Lynx. Since Oracle Java is no longer available via the default repositories I decided to manually install Java instead of adding a repository and possibly installing an older version. Since I need Java to run programs like Apache Ant, Apache FOP, and Saxon for my work as a freelance Perl programmer I prefer to use the Oracle Java over OpenJDK even though the latter might be a solid alternative for my purposes.
In order to download the Standard Edition (SE) of the Oracle Java JDK first I clicked on the red "Download" button under the JDK heading on the Java SE Downloads page. This opened another page in my browser with a table of files with above it a "Accept License Agreement" box. I clicked the radio button in front of "Accept" and clicked the now bold jdk-6u26-linux-i586.bin link after "Linux x86 - Self Extracting Installer" entry in the table.
When the download had finished I moved the downloaded file to
/usr/local/java, made it executable, ran it, and deleted
it as follows:
sudo mkdir -p /usr/local/java sudo mv /home/john/Downloads/jdk-6u26-linux-x64.bin /usr/local/java cd /usr/local/java sudo chmod 700 jdk-6u26-linux-x64.bin sudo ./jdk-6u26-linux-x64.bin sudo rm jdk-6u26-linux-x64.bin sudo ln -s jdk1.6.0_26 /usr/local/java/latest
The installer tried to open a browser window. However, this failed, I guess because of Firefox running as a normal user.
Now, with the Java SE Development Kit 6 update 26 installed
I only needed to add two variables to
/etc/environment and extend the
PATH variable. Notice that in the previous step
I created a symbolic link named
latest. When a
newer JDK version comes out I only have to update this
symbolic link since I refer to latest in
JAVA_HOME="/usr/local/java/latest" JRE_HOME="/usr/local/java/latest/jre" PATH="/usr/local/java/latest/bin:\ /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
sudo vi /etc/environment and changed the
file until it was equal to the above four lines. Make sure
that nothing follows after the backslash except a newline.
If you put accidentally a space after the backslash you might
not be able to login later on. Also note that variable
interpolation as used in shell scripts does not
I made that mistake and ended up with no longer being able to
login. This was easy fixed by booting from a live CD and
If you don't want to log out and log back in to have the updated
/etc/environment read in just type:
After this you should be able to verify the version of both
java -version java version "1.6.0_26" Java(TM) SE Runtime Environment (build 1.6.0_26-b03) Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode) javac -version javac 1.6.0_26
Important: installing OpenJDK at a later stage along with Oracle Java JDK might result in hard to track issues.