How to build a Java environment under Linux
Virtual machine: VMware Workstation
System: Linux: CentOS-7-x86_64
tool:
Installation tool: SSH client
1 : Query the current system version
cat /proc/version
2 : First confirm whether the current system already has a java environment
java -version
3 :Check if the JDK installation package exists in the current system
rpm -qa | grep java
4 : If not, enter the /opt directory, create a new folder java7, and then enter the java7 folder
cd /opt
mkdir java7
cd java7
5 : Download jdk7 online in the java7 directory
wget http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz
6 : Unzip the current file to the folder
tar -zvxf jdk-7u79-linux-x64.tar.gz
7 : Configure environment variables
vi ~/.bash_profile
Enter the following:
export JAVA_HOME=/opt/java7/jdk1.7.0_79
export CLASSPATH=$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
8 : Make the configuration file effective
source ~/.bash_profile
9 : View the JDK version after installation
java -version
Recommended Posts