Saturday, May 18, 2024
HomeWeb application programmingJSP programmingTomcat: How to Set the JAVA_HOME Enviroment Variable

Tomcat: How to Set the JAVA_HOME Enviroment Variable

Modify the catalina.bat file so that the servlet engine can work with Java in Tomcat.

Catalina is Tomcat’s servlet container that implements specifications for JSP and servlets. It was introduced in Tomcat version 4.x and is a core component of getting your Tomcat server up and running.

This information is stored in the file catalina.bat. We will have to go in manually and add in a path to our JDK install via the JAVA_HOME environmental variable.

1. Navigate to the directory where Tomcat is installed, and go into the \bin folder (c:\tomcat\bin). Right-click the file catalina.bat, and then select Edit. (I used Notepad++, but regular Notepad is fine.)


2. Scroll down in the code until you pass the end of the beginning “rem” comments, and insert the following code pointing to your JDK’s root directory:

set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_06

Be sure you are pointing to YOUR computer’s location of the JDK, not the exact one listed above.

3. Save your changes, and restart Tomcat.

Tomcat catalina.bat set enviroment

Catalina.bat is part of Tomcat, the open source web server and servlet container for rendering and displaying JSP/Servlet powered web pages. If you want to learn how to install Tomcat and stumbled upon this page first, please see our tutorial on installing Tomcat here.

Chris Luongo
Chris Luongo
Chris is a self-taught web designer and developer out of Atlanta, GA. This geek enjoys coffee, cold brews, bike riding, and twisting any form of tech into submission.


Please enter your comment!
Please enter your name here

Most Popular


Recent Comments

error: Content is protected !!