Tomcat download
Http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi
Download version is jakarta-tomcat-5.0.28
Ii. Installation
1. Install j2sdk first
My installation path is: D: \ Program Files \ Java \ j2sdk
2. Install eclipse again
Eclipse is a green software and does not need to be installed. You can decompress the downloaded eclipse package.
My installation path is: D: \ Program Files \ Java \ eclipse
3. install tomcat
Download the installation file and follow the installation instructions.
My installation path is: D: \ Program Files \ Java \ Tomcat
4. Install the eclipse plug-in
Chinese pack
Directly decompress the contents in the features and plugins folders in the compressed package NLpack-eclipse-SDK-3.0.x-win32 to the same name folder in the eclipse folder.
Tomcat plug-in
Decompress the package tomcatPluginV3 and extract the content in the plugins folder to the folder with the same name in the eclipse folder.
Iii. Environment Configuration
1. system environment variable configuration
Right-click "my computer"-> advanced-> environment variable,
Set the JAVA_HOME variable to the directory "D: \ Program Files \ Java \ j2sdk" installed on it ";
The TOMCAT_HOME variable points to the installed directory "D: \ Program Files \ Java \ Tomcat ";
The PATH variable contains "% JAVA_HOME % \ bin ;";
The CLASSPATH variable contains "% JAVA_HOME % \ lib \ tools. jar ;";
2. java Runtime Environment configuration in eclipse
In the main eclipse window, choose "window"> "preference"> "java"> "installed JRE" and select the j2sdk we have installed.
3. Configure the Sysdeo Tomcat plug-in
In the main eclipse window, choose "window"> "preference"> "tomcat". Select "version 5.x" for tomcat version (the version we have installed). Enter the path for installing tomcat in tomcat home. Here is D: \ Program Files \ Java \ Tomcat.
Switch to the Advanced option, and enter the tomcat installation path at tomcat base. Here is D: \ Program Files \ Java \ Tomcat.
Switch to the JVM Setting option and make sure that jre is the j2sdk version you have installed. Here we select j2sdk.
Switch to the Tomcat Manger App and add a user to the management interface.
Finally, press the Apply button and then confirm.
Check whether the configuration is successful. In the main eclipse window, press the tomcat run button and enter http: // localhost: 8080 in the address bar of the browser. If the tomcat page appears, the configuration is successful.
4. Programming
1. Create a Tomcat Project
Right-click the blank area in the "package Resource Manager" window, choose "CREATE"> "Tomcat Project", enter the Project name in the Project name, enter tomcat_test here, and click "finish.
2. Create a JSP page
In package explorer, right-click tomcat_test, create a file, and enter HelloWorld. jsp in the file name (the extension cannot be missing). In the text editing window, enter the following code:
<Html>
<Head>
</Head>
<Body>
<H1> Hello World
</Body>
</Html>
Save the settings.
5. Deploy the JSP page
The deployment here is a simple method: first, copy the above to the tomcat_test directory in the workpalce directory of eclipse to the webapps directory under the tomcat directory, and then to the server in the conf directory. xml for text editing, add the following host element before </engin>:
<Host name = "*. *" debug = "0" appBase = "webapps"
UnpackWARs = "true" autoDeploy = "true">
</Host>
Save and start tomcat, as long as you enter http: // * in the browser window ://*. *. *. *: 8080/tomcat_test/HelloWorld. the jsp browser will display "Hello World", which indicates that your jsp page is successfully deployed and published, and others will be able to access your page online.
(*. * Indicates the IP address of the host where the tomcat server is installed)
Vi. Notes
(1) Select j2sdk instead of jre because j2sdk has a java Runtime Environment and classes required by java programs, while jre only has a runtime environment.
(2) due to frequent software upgrades, you often need to reset the environment variables or reconfigure them. For example, you can upgrade the JDK version from 1.3 to 1.4, that is, the JDK directory name may need to be changed from "j2sdk1.3" to "j2sdk1.4". If so, eclipse may not be able to start any more (it needs to find the JAVA_HOME variable from the environment variable, the JAVA_HOME variable value has been changed from j2sdk1.3 to j2sdk1.4 ). Likewise, the software of jakarta-tomcat is frequently upgraded. Now, Tomcat is used in combination with eclipse. Therefore, you may need to reset the Tomcat installation directory in eclipse for each Tomcat upgrade. If we follow the traditional installation method, we need to set or configure the software every time we upgrade it, which is very troublesome. The solution to this problem is simple. You only need to remove the default software installation directory name from the version number (if you are worried about forgetting the version number, you only need to add a readme file to the directory to describe it ). This method is used in the above installation process.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.