Install OpenJDK 7 on Ubuntu 12.04 (also in AWS EC2)

First, we have to update apt-get because this is not up to date in this version.

1

sudo apt-get update

Then we have to install the OpenJDK 7

1

sudo apt-get install openjdk-7-jre

After the installation, we have to create a new file called bash_profile. This will be used to set variables at the start up.

1

nano~/.bash_profile

Then put this in your file, or wherever your Java version is installed. But be aware that you do not add /bin to JAVA_HOME or JRE_HOME variable, this is done by the system. Add it just in the PATH variable.