Installing JAVA

  
under CentOS7

Step 1: Check if the JDK that comes with Linux is installed

The installed CentOS will come with OpenJdk. With the command java -version , the following information will be available:

java version "1.6.0" OpenJDK Runtime Environment (build 1.6.0-b09) OpenJDK 64-Bit Server VM (build 1.6.0-b09, mixed mode)

Best to uninstall first Open openjdk, install sun company jdk.

First look at rpm -qa |  Grep java

If it is

, the following information is displayed:

java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 java-1.6.0-openjdk -1.6.0.0-1.7.b09.el5

Uninstall:

rpm -e --nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5

If you can't find openjdk source, you can uninstall it like this

yum -y remove Java java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 yum -y remove java java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5

The second step, Install SUN's JDK

1. Download the tarball

2. Create a new application directory (put the software you need in this directory for the same management). For example: usersoft

mkdir /

3. Copy the downloaded file to the /usersoft directory

4. Then configure the environment variable and enter the following command to enter the configuration file.

[root@localhost java]# vi /etc/profile Add

to the file export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL export JAVA_HOME=/usersoft/java/jdk1.7.0_60 export PATH =$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
5, let the environment variables take effect. Execute the configuration file to make it take effect immediately. Enter the following command:

[root@localhost java]# source /etc/profile

View the current java installation version [root@localhost java]# java -version

End!

Copyright © Windows knowledge All Rights Reserved