Configuring Eclpise+tomcat and Implementing JSP deployment

Source: Internet
Author: User
Tags variables version variable win32 window zip tomcat tomcat server
Js one. Download

J2SDK Download
Http://java.sun.com/j2se/1.4.2/download.html
Download version is j2sdk-1_4_2_08

Eclipse Downloads
http://www.eclipse.org/downloads/index.php
Download version is Eclipse-sdk-3.0.2-win32

ECLIPSE plugin Download

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

two. Installation

1. Install J2SDK First
I install the path is: D:\Program files\java\j2sdk

2. Install Eclipse again
Eclipse is green software and does not need to be installed, unzip the downloaded Eclipse compression pack.
The path I install is: D:\Program files\java\eclipse

3. Install Tomcat
Download back is a setup file, follow the installation prompts to do it
The path I install is: D:\Program files\java\tomcat

4. Install Eclipse Plugin
Chinese bag
Extract the contents of the features and plugins two folders directly from the compressed package into a folder with the same name in the Eclipse folder Nlpack-eclipse-sdk-3.0.x-win32.
Tomcat Plug-in
Unzip the compressed package tomcatPluginV3 and unzip the contents of the Plugins folder to the same folder within the Eclipse folder.

three. Environment Configuration

1. System environment Variable Configuration
Right-click My Computer-> advanced-> environment variable,
Set the Java_home variable to point to its installed directory "D:\Program FILES\JAVA\J2SDK";
The tomcat_home variable points to its installed directory "D:\Program Files\java\tomcat";
The path variable contains "%JAVA_HOME%\BIN;" ;
Classpath variables contain "%JAVA_HOME%\LIB\TOOLS.JAR;" ;

Configuration of Java Runtime Environment in 2.eclipse
In the Eclipse main window, the Windows-> Preferences->java-> the installed JRE, select the J2SDK that we have installed

3. Configure the Sysdeo Tomcat plugin
In the Eclipse Main window, window-> preference->tomcat,tomcat version version 5.x (our version installed), Tomcat home fills us with the path of Tomcat installation, this is D:\ Program Files\java\tomcat.
Switch to the advanced option, and then fill in the Tomcat base where we install Tomcat, which is D:\Program files\java\tomcat.
Switch to the JVM setting option to make sure the JRE is the J2SDK version you have installed, and we choose J2SDK here.
Switch to Tomcat manger App to add a user to the admin interface.
Finally press the Apply button and then in the OK.
Check that the configuration is successful simply by pressing the Tomcat button in the Eclipse main window and then typing http://localhost:8080 in the address bar in the browser, which proves that the configuration was successful if the Tomcat page appears.

Four. Writing Programs

1. Create a Tomcat project
Right-click the space in the Package Explorer window, create a new->tomcat project, fill in the name of the project in the project name, and here I'll fill in the Tomcat_test and click "Finish".

2. Create a JSP page
In Package Explorer, right-click "Tomcat_test", create a new-> file, fill in the file name helloworld.jsp (the extension cannot be missing), and enter the following code in the Text editing window:


<body>


</body>

and then save.

Five. Deploying JSP pages

The deployment here is a simpler approach: first, copy the Tomcat_test directory of Eclipse's Workpalce directory to the WebApps directory in the Tomcat directory, and then edit the Server.xml in the Conf directory, Before </engin>, add the following host element:

Unpackwars= "true" autodeploy= "true" >

</Host>

Then save, then start Tomcat, so as long as you enter the Http://*.*.*.*:8080/tomcat_test/helloworld.jsp browser in the browser window will show "Hello World", This means that your JSP page deployment is successful and others will be able to access your pages online.

(*.*.*.* refers to the host IP address on which the Tomcat server is installed)

Six. A few notes

(1) Select J2sdk instead of JRE because the J2SDK has a Java running environment and a class that the Java program needs, and the JRE has only a running environment.

(2) because the software itself upgrades more frequently, often need to reset the use of the environment variables or reconfiguration, such as the JDK version from 1.3 to 1.4, that is, the JDK directory name may be changed from "j2sdk1.3" to "j2sdk1.4", if so, Eclipse may not be able to start again (it looks for the java_home variable from the environment variable, and the Java_home variable value has changed from "j2sdk1.3" to "j2sdk1.4"). Similarly, jakarta-tomcat This software upgrade is more frequent, now with Eclipse to use Tomcat, then each Tomcat upgrade, you may have to reset the Tomcat installation directory in eclipse. If we follow the traditional installation method, we have to set up or configure the software every time, this is very troublesome. For this type of problem, the solution is simple, as long as the default software installation directory name to remove the version number (if you worry about forgetting the version number, just add a Readme file in the directory to explain it). This approach is used in the installation process described above.

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.