Step 1
Download the required java version from below java archive link.
for 6
JAVA 6
for 7
JAVA 7
for 8
JAVA 8
Step 2
Extract the package in =to the required directory.
tar -xzf jdk-XUxx-linux-xxx.tar.gz
Step 3
Install the java with alternatives.
go to the java directory that you have extracted.
cd /opt/jdkx.x.x_xx/
install with below command
alternatives --install /usr/bin/java java /opt/jdkx.x_xx/bin/java 2
now select that which you want to be default to work with below command
alternatives --config java
example output
In this java has been installed still we need to setup javac and jar command with alternatives.
Step 4
With the following command we can install jar and javac
alternatives --install /usr/bin/jar jar /opt/jdkx.x.x_xx/bin/jar 2
alternatives --install /usr/bin/javac javac /opt/jdkx.x.x_xx/bin/javac 2
alternatives --set jar /opt/jdkx.x.x_xx/bin/jar
alternatives --set javac /opt/jdkx.x.x_xx/bin/javac
Now check the java version with below command
java -version
Step 5
Set JAVA home in to the bash_profile
export JAVA_HOME=/opt/jdkx.x.x_xx
export JRE_HOME=/opt/jdkx.x.x_xx/jre
export PATH=$PATH:/opt/jdkx.x.x_xx/bin:/opt/jdkx.x.x_xx/jre/bin
that's all now you can use java.
Download the required java version from below java archive link.
for 6
JAVA 6
for 7
JAVA 7
for 8
JAVA 8
Step 2
Extract the package in =to the required directory.
tar -xzf jdk-XUxx-linux-xxx.tar.gz
Step 3
Install the java with alternatives.
go to the java directory that you have extracted.
cd /opt/jdkx.x.x_xx/
install with below command
alternatives --install /usr/bin/java java /opt/jdkx.x_xx/bin/java 2
now select that which you want to be default to work with below command
alternatives --config java
example output
In this java has been installed still we need to setup javac and jar command with alternatives.
Step 4
With the following command we can install jar and javac
alternatives --install /usr/bin/jar jar /opt/jdkx.x.x_xx/bin/jar 2
alternatives --install /usr/bin/javac javac /opt/jdkx.x.x_xx/bin/javac 2
alternatives --set jar /opt/jdkx.x.x_xx/bin/jar
alternatives --set javac /opt/jdkx.x.x_xx/bin/javac
Now check the java version with below command
java -version
Step 5
Set JAVA home in to the bash_profile
export JAVA_HOME=/opt/jdkx.x.x_xx
export JRE_HOME=/opt/jdkx.x.x_xx/jre
export PATH=$PATH:/opt/jdkx.x.x_xx/bin:/opt/jdkx.x.x_xx/jre/bin
that's all now you can use java.
No comments:
Post a Comment