Installing JDK and configuring the JDK environment diagram in Linux
One: First detect if the JDK is installed
To run the command:
# Rpm-qa|grep JDK
Or
# rpm-q JDK
Or
#find/-name jdk*
/soft/openfire_java/jdk-7u40-linux-x64.rpm
/usr/java/jdk1.7.0_15
/usr/java/jdk1.7.0_15/jre/lib/servicetag/jdk_header.png
/usr/java/jdk1.7.0_15/lib/visualvm/profiler/lib/deployed/jdk15
/usr/java/jdk1.7.0_15/lib/visualvm/profiler/lib/deployed/jdk16
/usr/java/jdk-7u15-linux-x64.rpm
Assuming that the JDK has been installed, the corresponding JDK version number is displayed as above.
II: Uninstalling the system's own JDK or installed JDK
Uninstall the default:
Log in to the system with the root user and open SSH secure terminal input
# Rpm-qa|grep GCJ
The following two lines of information are included in the display:
# JAVA-1.4.2-GCJ-COMPAT-1.4.2.0-27JPP
# JAVA-1.4.2-GCJ-COMPAT-DEVEL-L.4.2.0-27JPP
Unloading
# RPM-E JAVA-1.4.2-GCJ-COMPAT-DEVEL-L.4.2.0-27JPP
# RPM-E JAVA-1.4.2-GCJ-COMPAT-L.4.2.0-27JPP
Uninstall any other JDK you have installed directly with RPM-E <javaXXXXX>
Uninstall the RPM version of the JDK:
#rpm-qa|grep JDK
Display: jdk-1.7.0_15-fcs.x86_64
Uninstall: #rpm-e--nodeps jdk-1.7.0_15-fcs.x86_64
II: Download and install the JDK
1. Download:
: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
My system is CentOS linux64, I downloaded the jdk-7u15-linux-x64.rpm
2. Remember to install using the root user.
Download to the Local. rpm file and upload it to the server.
For example: Create a new Java folder in the/usr/folder and upload it to this folder.
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvahvhahvhz29uz3ppotk5otk=/font/5a6l5l2t/fontsize/400/fill/ I0jbqkfcma==/dissolve/70/gravity/southeast ">
After uploading successfully, go to this folder
#cd/usr/java
installation program
#rpm-IVH jdk-1_5_0-linux-i586.rpm
Install the installation protocol, etc., press accept to be able.
Assuming that a dependency packet error occurs, it is not necessary to ignore it.
3 . Environment variable settings.
#vi/etc/profile
added after export PATH USER LOGNAME MAIL HOSTNAME histsize Histcontrol
Export Java_home=/usr/java/jdk1.7.0_15
Export classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export path= $PATH: $JAVA _home/bin
Save exit.
# source/etc/profile # #使环境变量生效
# set
4. Check the Java version number
#java-version
Output:
Java Version "1.7.0_15"
Java (TM) SE Runtime Environment (build 1.7.0_15-b03)
Java HotSpot (TM) 64-bit Server VM (build 23.7-b01, Mixed mode)
Indicates that the JDK was successfully installed
Installing JDK and configuring the JDK environment diagram in Linux