The openjdk of the system is 1.6* and there is already a project in use. To use jdk1.7 for new projects on-line, you need to specify the JDK environment variables used by Tomcat to run as follows:
Tomcat DOWNLOAD Link: http://pan.baidu.com/s/1geUrWrx Password: lpy1
JDK Download Link: Http://pan.baidu.com/s/1kUSNRGN Password: viub
The system specifies that Tomcat uses the JDK in 2 ways, one is multiple user modes, modifies the current user system environment variable, and the other is the path of the specified JDK, with the same user delegating multiple Tomcat and multiple JDK.
First method: (Configure JDK, do not configure Tomcat)
Here are the extracted Tomcat and JDK:
[[email protected] ~]$ ls
apache-tomcat-7.0.57 apache-tomcat-7.0.57.tar.gz jdk1.7.0_72 jdk-7u72-linux-x64.tar.gz
Configuration of current user system environment variables:
[[email protected] ~]$ vim. Bash_profile//Append the following 6 lines to the end of the file
Java_home=/home/weblogic/jdk1.7.0_72
Path= $JAVA _home/bin: $PATH
Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export Java_home
Export PATH
Export CLASSPATH
[[email protected] ~]$ source. bash_profile
A comparison of JDK for the current user's JDK and system environment:
[Email protected] ~]$ java-version
Java Version "1.7.0_72"
Java (TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot (TM) 64-bit Server VM (build 24.72-b04, Mixed mode)
[Email protected] ~]$ Su-root
Password:
[Email protected] ~]# java-version
Java Version "1.7.0_99"
OpenJDK Runtime Environment (rhel-2.6.5.0.el6_7-x86_64 u99-b00)
OpenJDK 64-bit Server VM (build 24.95-b01, Mixed mode)
Run the extracted tomcat well, if there is a second tomcat new user to the new JDK system environment variables and the same as above, the Tomcat configuration file does not need to be modified.
Second approach: (Configure Tomcat, do not configure JDK system environment variables)
The JDK is unzipped well put on that without configuration, modify the path of Tomcat Java_home and JAVA_JRE:
Switch to the bin directory of Tomcat:/home/weblogic/apache-tomcat-7.0.57/bin
To modify a file:
[[email protected] bin]$ vim catalina.sh//Append the following 2 lines
Export java_home=/home/weblogic/jdk1.7.0_72
Export JRE_HOME=/HOME/WEBLOGIC/JDK1.7.0_72/JRE
[[email protected] bin]$ vim setclasspath.sh //also append the following 2 lines
Export java_home=/home/weblogic/jdk1.7.0_72
Export JRE_HOME=/HOME/WEBLOGIC/JDK1.7.0_72/JRE
Starting Tomcat Watch the JDK that is called when the output is started will know the JDK that is being used by the current Tomcat boot.
[[email protected] bin]$./catalina.sh start
Using catalina_base:/home/weblogic/apache-tomcat-7.0.57
Using Catalina_home:/home/weblogic/apache-tomcat-7.0.57
Using Catalina_tmpdir:/home/weblogic/apache-tomcat-7.0.57/temp
Using Jre_home:/home/weblogic/jdk1.7.0_72
Using CLASSPATH:/home/weblogic/apache-tomcat-7.0.57/bin/bootstrap.jar:/home/weblogic/apache-tomcat-7.0.57/bin/ Tomcat-juli.jar
Tomcat started.
The system process can also be found:
[[Email protected] ~]$ PS Ax | grep Tomcat
4573 PTS/2 Sl 0:07/home/weblogic/jdk1.7.0_72/bin/java-djava.util.logging.config.file=/home/weblogic/apache-tomcat -7.0.57/conf/logging.properties
-djava.util.logging.manager=org.apache.juli.classloaderlogmanager-djava.endorsed.dirs=/home/weblogic/ Apache-tomcat-7.0.57/endorsed-classpath
/home/weblogic/apache-tomcat-7.0.57/bin/bootstrap.jar:/home/weblogic/apache-tomcat-7.0.57/bin/ Tomcat-juli.jar -dcatalina.base=/home/weblogic/apache-tomcat-7.0.57-dcatalina.home=/home/weblogic/ apache-tomcat-7.0.57
-djava.io.tmpdir=/home/weblogic/apache-tomcat-7.0.57/temp org.apache.catalina.startup.Bootstrap Start
4658 PTS/2 s+ 0:00 grep Tomcat
This article is from the "LINUX Super Dream" blog, make sure to keep this source http://215687833.blog.51cto.com/6724358/1761292
TOMCAT Specifies the installation configuration of the JDK-linux