(CLI) tutorialHow To

Manually Install Oracle Java CLI Style

This entry is part 1 of 3 in the series (CLI) tutorial

This how-to is a command-line instruction (CLI) tutorial, a step-by-step guide to manually install Oracle’s Java from a precompiled bin. I’m using Ubuntu server 13.04 and JDK7 in this example, however you could substitute any of the JKD versions and Linux distribution as by your own requirements.

An application or service requires a Sun/Oracle Java installation instead of an OpenJDK.

1. You have a Ubuntu system running,
2. you know how to login to your system,
3. you know how to get to a terminal, (I have no X there is only CLI)
4. you have tar and wget installed on your system
5. and, MOST IMPORTANTLY the system has Internet access.

1. Download Java SE 7 JDK for your Linux archive. For this example I’m using jdk-7u40-linux-x64.tar.gz, however you can select the version you need. (I used my browser on another machine to find the correct url- http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html)
a. agree to the license,
b. then copy the link address you need i.e. http://download.oracle.com/otn-pub/java/jdk/7u40-b43/jdk-7u40-linux-x64.tar.gz
c. use wget with no cookies to download the file to your machine
          cookies wget –no-cookies –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com” “use link address”

2. Move the archive to /opt/
          sudo mv jdk-7u40-linux-x64.tar.gz /opt/

3. Change to /opt/ folder and extract the JDK from the archive
          cd /opt/

4. Extract the file – all the files form this example was extracted to a new jdk1.7.0_40 folder
          sudo tar zxvf jdk-7u40-linux-x64.tar.gz

5. Make symbolic links to the new java binary.
          sudo ln -s -b /opt/jdk1.7.0_40/jre/bin/java /etc/alternatives/java
          sudo ln -s -b /opt/jdk1.7.0_40/jre/bin/java /usr/bin/java

6. Test your work
          java -version


Please reply with any comments if this helps or if you have an improvement on the steps.

Next article > how to install and configure Ubuntu server <maybe this should have come first>

Series NavigationLinux, Apache, MySQL & PHP CLI Style >>

Leave a Reply