Install jdk
(1) Download jdk
(2) Unzip
tar -xvf jdk.tar.gz -C target path (/usr/local/jdk/)
(3) Configure environment variables
① vi /etc/profile
② Add at the end of the line
#set java environment
JAVA_HOME=/usr/local/jdk/jdk1.7.0_71
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
Save and exit
③source /etc/profile makes the changed configuration take effect immediately
Install tomcat
1 download
2 Unzip
tar –zxvf apache-tomcat-7.0.57.tar.gz -C target path (/usr/local/tomcat/)
3 Edit the file /usr/local/tomcat/bin/catalina.sh (modify according to your own jdk path) At the beginning of the body of the file, before the official code, add the following code at approximately 99 lines:
export JAVA_HOME=/usr/local/jdk/jdk1.7.0_75
export JRE_HOME=/usr/local/jdk/jdk1.7.0_75/jre