Uninstallation of JDK (Open Java)
# yum remove java
Installing from rpm package
Go to the Oracel Download page and download the package.
# wget http://download.oracle.com/otn-pub/java/jdk/7u17-b02/jdk-7u17-linux-x64.rpm
Go to the downloaded location
change the package mode to executeable
# chmod 755 jdk-7u17-linux-x64.rpm
Install it
# yum install jdk-7u17-linux-x64.rpm
Now check the version
# java -version
You should get the result like below:
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
Setting JAVA_HOME for a single user and all users:
check java by
#which java
/usr/bin/java
we can check whether this java file is located
# ls -al /usr/bin/java
lrwxrwxrwx. 1 root root 26 Mar 24 20:15 /usr/bin/java -> /usr/java/default/bin/java
#cd /usr/java
#ls -al
drwxr-xr-x. 3 root root 4096 Mar 24 20:15 .
drwxr-xr-x. 14 root root 4096 Mar 24 20:15 ..
lrwxrwxrwx. 1 root root 16 Mar 24 20:15 default -> /usr/java/latest
drwxr-xr-x. 8 root root 4096 Mar 24 20:15 jdk1.7.0_17
lrwxrwxrwx. 1 root root 21 Mar 24 20:15 latest -> /usr/java/jdk1.7.0_17
The above shoes that default softlink to /usr/java/latest and latset softlink to /usr/java/jdk1.7.0_17
The genuine directory for java is /usr/java/jdk1.7.0_17
For a single user:
# vi ~/.bash_profile
# export JAVA_HOME=/usr/java/jdk1.7.0_17
# export PATH=$PATH:/usr/java/jdk1.7.0_17/bin
For all users:
# vi /etc/profile
# export JAVA_HOME=/usr/java/jdk1.7.0_17
# export PATH=$PATH:/usr/java/jdk1.7.0_17/bin
No comments:
Post a Comment