Skip to content
rpillich edited this page Oct 30, 2014 · 5 revisions

Install Java 7 Release 1.7

First of all, check the installed version of Java:

java --version

The first line of the response should be:

java version "1.7.0_nn"
````
where nn is any release number. 
**If 1.7 is not already installed, obtain the 1.7 release of Java 7 and install it**.

## Ubuntu & Debian Systems
To install Oracle Java 7 on Ubuntu systems, it is necessary to specify the code name for the Ubuntu version: https://wiki.ubuntu.com/Releases
* Ubuntu 12.04 = precise
* Ubuntu 12.10 = quantal
* Ubuntu 13.04 = randy
* Ubuntu 13.10 = saucy

The following example is for Ubuntu 12.04, code name = precise

http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html

>````
sudo echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
sudo echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo update-alternatives --config java
````

Picking the oracle java 7 alternative also shows you the installation path

### Check / Configure the $JAVA_HOME Environment Variable

The JAVA_HOME environment variable should contain the JDK installed directory. Check with:
>````
echo $JAVA_HOME
[JDK installed directory]
````

If JAVA_HOME is not set to your Java 7 path then edit "/etc/profile":

>````
sudo nano /etc/profile 
````

Add this line at the end of the file. (change "/usr/bin/java" to the install location on your system)

>````
export JAVA_HOME=/usr/lib/jvm/java-7-oracle
````

Source the profile and check again

>````
source /etc/profile
echo $JAVA_HOME
/usr/lib/jvm/java-7-oracle
````

### Mac OS X Systems
The Oracle Java 7 installation image can be downloaded from: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Complete installation instructions can be found at:
http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html
Clone this wiki locally