How to configure environment variables for Tomcat and JDK?
- Set up the Tomcat environment variables.
a. Open the installation directory of Tomcat and locate the catalina.bat file (for Windows) or catalina.sh file (for Linux) under the bin folder.
b. Copy the path of the file.
On a Windows system, right-click on “Computer” or “This PC”, select “Properties”, click on “Advanced system settings”, and then click on “Environment Variables” in the window that pops up.
d. Click on “New” in “System Variables”, enter the variable name “CATALINA_HOME”, and input the installation path of Tomcat as the variable value.
e. Click on “OK” to save the variable settings.
- Set up the JDK environment variable.
Open the installation directory of JDK, locate the bin folder, and copy the path of that folder.
In the Windows system, also click on “New” in the system variables, and enter the variable name “JAVA_HOME” with the variable value as the JDK installation path.
In the “System Variables” section, locate the “Path” variable, click on “Edit”, and add “;%JAVA_HOME%\bin” at the end of the variable value (be sure to include the semicolon).
Click “OK” to save the variable settings.
You can check if the JDK is configured correctly by entering “java -version” and “javac -version” in the command line window.