Wednesday, April 5, 2017

How to Install Oracle Java on Ubuntu Linux

As WSO2 products require to have Java installed, this article will guide you through the process of installing Java 7 on Ubuntu environment.

First, add Oracle's PPA, then update your package repository.

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

To install JDK 7, use the following commands:

sudo apt-get install oracle-java7-installer

sudo apt-get install oracle-java7-set-default

Edit the system PATH file /etc/profile and add the following system variables to your system path. Use gedit, nano or any other text editor, as root, open up /etc/profile.

To open in gedit use below command:

sudo gedit /etc/profile

Scroll down to the end of the file using your arrow keys and add the following lines below to the end of your /etc/profile file:

If you are installing the JDK use below configuration (note: you are required to change the $JAVA_HOME as per the jdk location on your computer):

JAVA_HOME=/usr/local/java/jdk1.7.0_45
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH

Or if you are installing the JRE use below:

JRE_HOME=/usr/local/java/jre1.7.0_45
PATH=$PATH:$JRE_HOME/bin
export JRE_HOME
export PATH

Save the /etc/profile file and exit.

No comments:

Post a Comment