We all know Tomcat! Because of its advanced technology, stable performance, and free, it is favored by Java enthusiasts and has been recognized by some software developers, become the most popular Web application server, is also running servlet and JSP container. Holiday time occasionally installed, installation version and the installation version of the have tried, feel free to install version of the comparison is better, related to the configuration of more, more files, according to my knowledge now, simple to do a free version of the basic configuration of Tomcat and installation method.
First, configure the JDK
To install Tomcat on your computer requires JDK support because Tomcat is a very lightweight Web server written in the Java language.
The latest version of Java SE:http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u4-downloads-1591156.html, Currently the latest version is the Java SE 7u4.
1, the first to download their own JDK (used here is 1.7) after downloading, decompression or installation, it is best to install the JDK and JRE in the same Java directory, such as D:\Program files\java\jdk1.7.
2. Configuring System Variables
(1) Right click on "My Computer", select "Properties"-"Advanced" and click "Environment variables".
(2) In order to later can easily change the JDK path, and some other software, it is best to create a new java_home environment variable, the property value is "D:\Program files\java\jdk1.7", will "%java_home%\bin" Added to the PATH environment variable, preferably in front.
(3) Finally, under the "User Variable" box, click on the "New" button, "Variable name" fill "classpath", "Variable Value" fill ".; %java_home%\lib\tools.jar; %java_home%\lib\rt.jar ". After the configuration is complete, enter java–version in the command window to view the current version. A message appears indicating success.
Ii. Configuring Tomcat
1, download Tomcat.zip compressed package, I am using the latest 7.0.27, extracted to the D:\Program files\tomcat7 directory. Tomcat is:http://tomcat.apache.org/download-70.cgi, select 32-bit Windows Zip or 64-bit Windows zip option on the download page.
2 Settings for Environment variables:
First add the TOMCAT_HOME environment variable with a value of D:\Program files\tomcat7. Add the Catalina_home environment variable, the value is%tomcat_home%, in the Add catalina_base environment variable, the value is%tomcat_home%. The install-free version requires these two environment variables, written with the "%" number as a convenience to change the version later, you can directly modify the value of the tomcat_home, change the values of Catalina_home and catalina_base.
The most important thing for a free-to-install version is to modify the root directory under the Conf folder under the Startup.bat file, and if you do not modify it may not start Tomcat,
In front of the first line (or after echo off), add the following two lines:
Directory of SET JAVA_HOME=JDK
SET catalina_home= The directory of Tomcat before decompression.
If you need to use Shutdown.bat to shut down the server, add two lines as well.
3, so, run Startup.bat can run the server, run Shutdown.bat can shut down the server.
Iii. adding tomcat to the service
1, download the zip version from the Internet, need to join the service Tomcat, or you can not configure Tomcat, that is, unable to open Tomcatw.exe This program opened the Settings window.
First run Win+r Open the Run dialog box, enter the cmd command to open the console, use the CD command to enter the Tomat directory/bin folder, enter the following command:
Service.bat Install
Program tip: The service ' TOMCAT7 ' has been installed similar statements.
Description Service Tomcat has been successfully installed. By the way, when you don't want this tomcat, you can run Service.bat remove to remove the service. That is, uninstall.
3, to here, the service added successfully, and then in the Run window Input services.msc command, open the service window can see the Tomcat service has been added to the system, you can see the added service, by default, the service is run manually, in its properties, the startup type is changed to "automatic" , Tomcat starts in the background after the machine is booted (typically not set).
Iv. how Tomcat is launched
There are several ways to start a Tomcat server.
First: Start the service (server) in the command console and enter the following statement in the Command window to turn the Tomcat server on or off:
Net START service Name
NET stop service Name
Second: Use Startup.bat This batch file to open the Tomcat server, use the Shutdown.bat batch file to shut down the Tomcat server, in this way, the premise needs to add the above two sentences, otherwise cannot open or shut down the Tomcat server.
Third: Go to the Tomcat root directory under the bin directory, select Tomcat7w.exe file, select the Start button in the Open window to open, or select the Stop button to turn off the server.
Fourth: This is similar to the first, by opening the service window, selecting the service name of the Tomcat server, right-clicking to start or stopping.
For the above four kinds of starting mode, the fundamental is to start the service.
Tomcat Free Installation Configuration