Arthur Kharkivskiy
Arthur Kharkivskiy

Reputation: 540

A way to start tomcat with other java

I am exporting variables in the setenv.sh like this:

JAVA_HOME=/home/arthur/java8
JRE_HOME=/home/arthur/java8/jre
CATALINA_HOME=/home/arthur/tomcat8
PATH=$CATALINA_HOME/bin:$PATH
PATH=$JAVA_HOME/bin:$PATH

But tomcat started from tomcat8 folder starts with java6 variable. Why? Thank you!

Upvotes: 2

Views: 91

Answers (1)

Neeraj Jain
Neeraj Jain

Reputation: 7720

Try configuring tomcat configuration file using command

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

...

Then restart the server

sudo service tomcat7 restart

You can use below command to check Tomcat is using which JDK

 sudo service tomcat7 status

Upvotes: 1

Related Questions