How to configure the Tomcat server environment

Learning java web development is inseparable from server support. Here, IT Encyclopedia shares the steps of successful configuration.


Method / step

Download instructions, do not post the link address here, please Baidu.


JDK download, when you see the official webpage, after trying hard to enter the page as shown in the figure, please select the Accept License Agreement on the top of the figure when downloading, and then click the corresponding version according to your system. My system is 64-bit windows, choose jdk-7u45-windows-x64 to download.


Tomcat download, you need to download the version that matches the JDK, the official home page has the following picture, here corresponds to the latest version of the JDK is Tomcat 8.0. The downloaded file name is


Apache-tomcat-8.0.0-RC5-windows-x64.exe


4840919_20140527145635[1].png



Install and configure environment variables


1. Install the JDK first, just like you usually install the software, it is very foolish, and it will not be described here.


Here to explain, the general online copy experience is the direct default installation path, I am very much here to see the folder with the version number, when installing the selection path directly installed in the c drive folder JDK as shown below .


2, configure the JDK environment variables


This step is not understood by many people, and is generally directed at the configuration. To put it simply, it is quite a bit of a JDK path for you to install, so that you can compile it in the CMD command line.


1) Right click on the computer (My Computer) -> Properties or directly click on the Control Panel, the Control Panel home page will pop up.


2) Please select the environment variable and the window shown in Figure B will pop up.


4840919_20140527145659[1].png



3) New 3 variables need to be created in the system variable


Case is not distinguished. If the same variable name exists, use Edit to modify the variable value.


The variable name is JAVA_HOME, and the variable value is: C:\JDK (depending on the JDK path you installed, if it is the default, this form should be C:\Program Files\Java\jdk1.7)


The variable name is CLASSPATH and the variable value is .;%JAVA_HOME%\lib;


The variable name is PATH and the variable value is %JAVA_HOME%\bin


Now complete the JDK environment configuration, please enter the java -version test in the cmd command line interface to test whether the installation is successful. The following is the installation and configuration of the Tomcat server.



4840919_20140527145727[1].png

4840919_20140527145757[1].png


Tomcat installation and configuration

1, unzip the download file package, not used to the version number folder, here I am modifying the default folder name apache-tomcat-8.0.0-RC5-windows-x64 for tomcat. Ask the students to choose according to their own wishes.


Configuring the Tomcat environment variable


2. Open the system environment variable, please refer to the figure in the third step.


Add the following variables to the system variables


1) New TOMCAT_HOME variable


4840919_20140527145811[1].png


Variable name TOMCAT_HOME


Variable value c:\tomcat


The variable value is the tomcat decompression path we downloaded. Here is my c:\tomcat. If you have doubts, you can refer to the fifth step.


2) New CATALINA_HOME variable


4840919_20140527145826[1].png

Variable name CATALINA_HOME


Variable value c:\tomcat


That's right, the variable value of CATALINA_HOME is the same as the variable value of TOMCAT_HOME.


3) Modify the variable Path

4840919_20140527145837[1].png

Find the Path variable name in the system variable, double click or click Edit, add the following at the end


;%CATALINA_HOME%\bin;%CATALINA_HOME%\lib


It should be noted here that the values of the variables must be used; separated.


4) Start the Tomcat server


In the cmd command window, enter startup and enter as shown below.

4840919_20140527145904[1].png

Test whether the Tomcat server is successfully installed


Enter http://http://localhost:8080 or http://127.0.0.1:8080 in your browser.


The installation will be successful as shown below

4840919_20140527145922[1].png

Precautions

The value of the environment variable should be separated by a half-width English; there must be no "\" at the end. Whether there are extra letters or spaces between the values of each environment variable.


There are many online copying experiences that often recommend starting tomcat with service, but showing 'servic' is not an internal or external command. I can't use it. I use startup here.