Configure eclipse + Tomcat and implement JSP deployment

Source: Internet
Author: User

1. Download
  
J2sdk download
Http://java.sun.com/j2se/1.4.2/download.html
Download version is j2sdk-1_4_2_08
  
Download eclipse
Http://www.eclipse.org/downloads/index.php
Download version is eclipse-SDK-3.0.2-win32
  
Download Eclipse plug-in
  
Chinese package:
Http://sunsite.informatik.rwth-aachen.de/eclipse/downloads/drops/L-3.0.1_Translations-200409161125/NLpack-eclipse-SDK-3.0.x-win32.zip
  
Tomcat plug-in sysdeo eclipse Tomcat launcher Plugin:
Http://www.sysdeo.com/eclipse/tomcatPluginV3.zip
  
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
The plugin installation is simple. You only need to extract the downloaded atatplugin (tomcatpluginv3) to the Plugins directory of the eclipse installation directory.

 

Iii. Environment Configuration
  
1. system environment variable configuration
Right-click "my computer"-> "advanced"-> "environment variable" and set the java_home variable to point to the installed directory "D:/program files/Java/j2sdk ";
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:

 

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:

<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.

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.