1. Configure JDK
1. Download JDK
and decompress the package. Assume D: \ jdk6. Make sure that the bin directory is in this directory, the following java_home directory is D: \ jdk6.
2. configure system variables
(1) Right-click my computer ", select "properties"-"advanced" and click "environment variables ".
(2) in the "System variables" box, click the "new" button, enter "java_home" for "variable name", and enter the variable value in the directory where JDK is extracted, that is: d: \ jdk6.
continue to add the classpath variable value as ".; % java_home % \ Lib \ tool. jar; % java_home % \ Lib \ RT. jar; "
classpath can also be configured as D: \ jdk6 \ Lib
(3) Click" new "under the" user variable "box, set "path" to "variable name" and "variable value" to "% PATH %". % java_home % \ bin "
If Tomcat is installed, you can simply dress up.
2. Configure Tomcat
1. Download the Tomcat zip package and decompress it.
2. Modify startup. BAT file:
Add the following two lines before the first line --
set java_home = (JDK directory)
set catalina_home = (Tomcat directory after decompression)
if you need to use shutdown. if bat closes the server, add the above two lines.
3. In this way, run startup. BAT to run the server, and run shutdown. BAT to shut down the server.
3. Add tomcat to the service
1. Modify the service in the bin directory. BAT:
Add the following Code :
Add
REM Add the following line
set catalina_home = (Tomcat directory after decompression)
If REM has never installed tomcat, or ensure that services. MSC starts the Service Manager to check that there is no Apache Tomcat System Service. Now you can go to step 2 of REM. Otherwise, go down and reset the service name. You can customize the service name
REM to modify the following lines according to the description
set SERVICE_NAME = tomcat5
REM the row above, tomcat5 is changed to the service name you need. This will be the service name that will be operated later using net start/stop.
set pr_displayname = Apache Tomcat
in the above line of REM, change Apache Tomcat to the service name you need. This will be displayed in the Service Manager.
set pr_description = Apache Tomcat server-http://jakarta.apache.org/tomcat
REM does not change this line does not matter, is the service description, according to your own preferences.
-----------------------------------------------------------------------------
2. Run cmd to open the console, enter the Tomat directory/bin folder, and enter the following command to run.
Service. Bat install
ProgramTip: the service 'tomcat 5 (or SERVICE_NAME after you modify one) 'has been installed
It indicates that the Tomcat service has been installed successfully.
By the way, running service. Bat remove can remove the service.
3. Here, the service is successfully added and services are run. MSC, you can see the added service. By default, the service runs manually. In its properties, change the Startup Type to "automatic ", after the machine is started, Tomcat will be started in the background.
4. Console Control Service commands
Start the service
Net start service name
Close service
Net stop service name