The current environment is using Tomcat 7 + JDK 6. How to configure Tomcat to use JDK 7?
- Tomcat 7 (apt-get install)
- Debian 7.5
- JDK 6 and JDK 7
P.S Tomcat 7 is installed via
You may interest at this tutorial – Apache Tomcat 8 + JDK 8 on Debian
JAVA_HOME in this file
$ sudo vim /etc/default/tomcat7
#... # The home directory of the Java development kit (JDK). You need at least # JDK version 1.5. If JAVA_HOME is not set, some common directories for # OpenJDK, the Sun JDK, and various J2SE 1.5 versions are tried. #JAVA_HOME=/usr/lib/jvm/openjdk-6-jdk JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 #...
1.2 Restart Tomcat, done.
$ sudo service tomcat7 restart
1.3 Check this article to find out which JDK is used by Tomcat.
Make sure there is no extra space between the equal symbol “=”, it will cause “JAVA_HOME no found”, I spent hours fixing this bug!For example
#...Wrong, SPACE JAVA_HOME = /usr/lib/jvm/java-7-openjdk-amd64 #...Correct JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64