Install the jdk7 development environment in Linux and use linuxjdk7 for development.
1Download JDK 7 from the official website
Address:
Http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html
Download Linux-jdk-7u80 version:
Note: Use Login here (account: 96 **** 06@qq.com, password: X *** 1831234 *** 0)
2Use Xftp to upload files to the linux System for decompression
Put it in the/home/xiaohai/pack/directory.
Decompress the package:
# tar -zxvf jdk-7u80-linux-x64.tar.gz
Move jdk to the/usr/local directory.
# mv jdk1.7.0_80/ /usr/local/
3, Configure Environment Variables
Open the profile file
Run the following command:
# vim /etc/profile
Add the following configuration at the end of the file:
export JAVA_HOME=/usr/local/jdk1.7.0_80 export JRE_HOME=/usr/local/jdk1.7.0_80/jre export PATH=$PATH:/usr/local/jdk1.7.0_80/bin export CLASSPATH=./:/usr/local/jdk1.7.0_80/lib:/usr/local/jdk1.7.0_80/jre/lib
Or:
JAVA_HOME=/usr/local/jdk1.7.0_80 JRE_HOME=/usr/local/jdk1.7.0_80/jre CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export JAVA_HOME JRE_HOME CLASS_PATH PATH
Reload the file:
# source /etc/profile
4Check whether the java version is successfully installed.
Run the following command:
Show version
# java -version
Display execution Parameters
# javac
5. Jdk version problems exist.
The default jdk environment of centOS7 is 1.8. When you view the version, the following figure is displayed:
This is obviously not the information of the previous configuration. You need to modify some configurations:
View the java execution path
Run:
# which java
Enter the/usr/bin/path to display the soft connection of java:
Go to the/etc/alternatives directory:
The software points to the following path:
Java-& gt;/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64/jre/bin/java
Delete the soft link:
# rm java
Create a new java soft connection:
#ln -s /usr/local/jdk1.7.0_80/bin/java
Check again:
In this way, you can point to the jdk path you configured and view the version: