JDGuide
JDGuide

Reputation: 6525

Does Tomcat require JDK or JRE?

I've read many articles and posts related to Tomcat and the Java runtime. I am confused and need help. Can anybody clear my doubt regarding whether Tomcat requires JDK or JRE?

Upvotes: 63

Views: 77111

Answers (5)

impy
impy

Reputation: 1

Above java 9 (jdk 1.9) Oracle no longer intends for end-users to be installing a JRE or a JDK.

so above java 9 you'll only find jdk without jre.

Upvotes: 0

Jorge Lizaso
Jorge Lizaso

Reputation: 349

I'm running TOMCAT 7.0.92.0 builted in XAMPP v3.2.4 installed in C:\XAMPP in a Windows 10.

I had installed JDK jdk-13.0.2 with the following environment variables set:

CATALINA_HOME = "C:\xampp\tomcat"
JAVA_HOME = "C:\Program Files\Java\jdk-13.0.2\"
JRE_HOME = "C:\Program Files\Java\jdk-13.0.2\" 

*Tried also without setting JRE_HOME and also pointing it at C:\Program Files\Java\jdk-13.0.2\bin\

But it wouldn't work until I installed JRE jre1.8.0_241 and set JRE_HOME to "C:\Program Files\Java\jre1.8.0_241\"

Right now in XAMPP's Control Panel it shows the server at "Attempting to start Tomcat app..", and never shows it at running mode, but it's working.

Upvotes: 0

Vladan Ulardzic
Vladan Ulardzic

Reputation: 29

I did successfully installation of Apache Tomcat 7.0.56 when I installed C:\Program Files (x86)\Java\jre1.8.0_171 .

Additional note: After I did successfully installation of Apache Tomcat 7.0.56 when I installed C:\Program Files (x86)\Java\jre1.8.0_171 I have seen in Java Control Panel -> Desktop Settings:

Web Enabled : checked 
Platform : 1.8 
Product : 1.8.0_171 
Architecture : x86 Type : 
User Path : C:\Program files (86)\Java\jre1.8.0_171\bin\javaw.exe 
Runtime Parametars : (empty field) 

Upvotes: 1

buzard
buzard

Reputation: 174

The only notable difference using JDK over JRE is to enable debug mode when launching tomcat jvm.

in the RUNNING.txt we don't have clear distinction, the text deals with certain options, without telling which one :

Using JAVA_HOME provides access to certain additional startup options that are not allowed when JRE_HOME is used.

the information is inside catalina.sh script :

#   JAVA_HOME       Must point at your Java Development Kit installation.
#                   Required to run the with the "debug" argument.

Upvotes: 15

duemir
duemir

Reputation: 1316

Tomcat's RUNNING.txt which you can find in the root of the bundle states that Apache Tomcat requires Java Standard Edition Runtime Environment (JRE) to run. Minimum version of JRE depends on the version of Tomcat: for Tomcat 6.0 it is Java 5, for Tomcat 7.0 - Java 6.

However you can also use JDK because, as you probably know, it includes JRE (link). The only difference is in the configuration of environment variables. If you use JRE you should set JRE_HOME, if JDK - JAVA_HOME. Read RUNNING.txt for more details.

P.S. Web containers may require JDK in order to support JSP, because Java Compiler is required to compile Servlets which are generated from *.jsp files. Tomcat has Eclipse Java Compiler bundle so it can run on JRE and still support JSP.

Upvotes: 71

Related Questions