How to Change Java Version Used by Tomcat

How to change Java version used by TOMCAT?

When you open catalina.sh / catalina.bat, you can see :

Environment Variable Prequisites

JAVA_HOME Must point at your Java Development Kit installation.

So, set your environment variable JAVA_HOME to point to Java 6. Also make sure JRE_HOME is pointing to the same target, if it is set.

Update: since you are on Windows, see here for how to manage your environment variables

How to change Java Version for Apache Tomcat 9

There are multiple ways of doing so.

  1. Chaining global JAVA_HOME environment variables to the java you wish to use. Note that this will change Java for all apps running on that machine.

  2. Using setenv file. In CATALINA_BASE/bin directory open or create file named setenv.sh and put JAVA_HOME=/usr/lib/jvm/openjdk-8-jdk in it. This will change it only for your tomcat. Please note to change it to the JDK/JRE you want to use.

How to configure Tomcat to use Java 7

You answered your own question.! :)
All You need to do is link java 7 in your JAVA_HOME.!

More Info Here

Edit : (Based on alfabravo's comment :

You can definitely change the pointer to JAVA_HOME in your catalina.bat/sh

What will happen if i change the java version in tomcat to latest version

Most probably No.

But Yes in some cases,Tomcat may counter the issues about Incompatibilities between JDK 7 and JDK 6

http://www.oracle.com/technetwork/java/javase/compatibility-417013.html#jdk7



Related Topics



Leave a reply



Submit