Eclipse for Java EE use tutorial

Source: Internet
Author: User
Tags apache tomcat

1, the use of the environment as follows:

Computer system Type: 32-bit operating system

JDK usage version: jdk1.8.0_20

Tomcat usage Version: apache-tomcat-8.0.12

Eclipse Usage Version: Eclipse-jee-luna-sr2-win32

2. JDK environment variable settings:

New variable: Java_home--c:\program files\java\jdk1.8.0_20 (This is based on the path of the JDK you have installed)

Classpath ——.; %java_home%\lib;%java_home%\lib\tools.jar

(Do not forget that there is a small point in the front, note that all characters in the variable value are English characters)

Edit variable: path--%java_home%\bin;%java_home%\jre\bin

  (all variable values are separated by semicolons, but do not end with semicolons)

  To determine the success of the JDK setup: run cmd, enter Javac, and the following (1) content description has been configured successfully.

      

Figure (1)

3. Configure the server for Eclipse:

Please confirm that JDK (2) and Web Services ((3)) are configured to complete.

    

Figure (2)

    

Figure (3)

To configure Server Runtime environments, if empty, click the button Add, and the (4) dialog box appears:

          

Figure (4)

Next, click Next, (5), then Finish:

          

Figure (5)

Final result (6):

    

Figure (6)

  Configure the Tomcat server , such as the (7) server bar to have added the server's state, in the case of a blank state, that is, the server is not added, then in the white space

Right click-"new--" Server, pop up the following dialog box (figure (8)):

        

Figure (7)

          

Figure (8)

where Tomcat chooses its own version, Tomcat 8.0, the following host name is the default, and Server name is the default, of course,

You can also change the name you want. Then, select the appropriate Tomcat version in the following Server runtime environment, if not,

You can add it by clicking the Add Configure Runtime environments, and refer to step 4 for a specific procedure.

You can click Next to add a project, or you can just click Finish. You can then see the effect of (7), at which point the

A server file appears in the sidebar, which is a configuration file on the server that can be manually modified in the server configuration, (9).

                

Figure (9)

  Open the Package Explorer View method: window--"Show view--" other--"java--" package Explorer

Then, double-click on the figure (7) of Tomcat, open the Server's configuration Interface, (10):

    

Figure (10)

  Note: Server location Be sure to choose your own Tomcat's installation path, the start time in Timeout can take a larger value, to avoid the service startup time-out error.

     note the changes to save , or even start the service will not be accessible. You can then access the server to see if the configuration is successful, which normally is OK.

At this point, Eclipse is already configured to complete.

4. New Project: Demo

new--"Dynamic Web projece--" next--"Next

The Web. xml file cannot be generated automatically until (11), as shown here, must be checked.

    

Figure (11)

Click Finish to complete the new project.

New JSP file, right click webcontext--"new--" other--"web--" jsp file--"next--" index.jsp--"Finish

In this case, the following error may appear in the JSP file: "The superclass" Javax.servlet.http.HttpServlet "is not found on the Java Build Path",

This is because no packages are added.

  Workaround: Right-click on the Demo project-"Build path--" Configure build path--"libraries--" Add library--"Server Runtime

--"next--" Apache Tomcat v8.0--"finish--" OK Save

If there is no JSP Page view file in the project, create a new one. Then, publish the project with the server as follows:

(1) Right click on the Tomcat server shown in (7)-"Add and remove--" appears as shown in the dialog box, on the left to select the project to be published-"add--" Finish.

        

(2) Start the server. Once again right click tomcat--"First click Publish can be debugged, you can also start directly."

(3) test project. Enter an address in the Address bar to test your project.

At this point, the entire Eclipse configuration and simple project example is complete.

Eclipse for Java EE use tutorial

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.