First download the tar file of java version u required. Follow I downloaded 1.7
You will need sudo privileges to perform this task:
sudo su
The /opt directory is reserved for all the software and add-on packages that are not part of the default installation. Create a directory for your JDK installation:
mkdir /opt/jdk
and extract java into the /opt/jdk directory:
tar -zxf jdk-7u67-linux-x64.tar.gz -C /opt/jdk
Verify that the file has been extracted into the /opt/jdk directory.
ls /opt/jdk
Setting Oracle JDK as the default JVM
In our case, the java executable is located under /opt/jdk/jdk1.7.0_67/bin/java . To set it as the default JVM in your machine run:
update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.7.0_67/bin/java 100
and
update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.7.0_67/bin/javac 100
Verify your installation
Verify that java has been successfully configured by running:
update-alternatives --display java
and
update-alternatives --display javac
No comments:
Post a Comment