The Web development environment constructs Eclipse-java EE Chapter

Source: Internet
Author: User
Tags tomcat server java se

1. Download and install
1.1 Download JDK
Download the latest version of Java se:http://www.oracle.com/technetwork/java/javase/downloads/index.html on the official Java website

1.2 Download Java EE Latest Version:
Http://www.oracle.com/technetwork/java/javaee/downloads/index.html
1.3 Installing the JDK:
Perform the downloaded JDK installation package installation.

1.4 Downloads Eclipse
Open http://www.eclipse.org/downloads/eclipse-packages/

1.5 Installing Java EE
Unzip the downloaded Java EE and run the \glassfish4\bin\pkg.bat, enter Y and then wait to complete the installation when prompted to install input <y/n>.

1.6 Installing Tomcat
Go to the official website (http://tomcat.apache.org/) and download the latest version of Tomcat 9 directly.

After the download is complete, unzip the package into the Java installation directory in Tomcat

2. Configuring and starting to use
2.1 Run Eclipse Java EE.

2.2 Setting up Tomcat
In Eclipse, click the menu bar window->preferences, click Server/runtime environments:

Click the "ADD" button to create a new server. We've installed Tomcat 9.0 before, so choose it here too.

Click "Next" to proceed to the next step.

Enter the Tomcat installation directory in the text box under Tomcat installation directory and click "Finish" to complete the configuration.

2.3 Setting the default character set
In Eclipse, the current operating system's character set will be used by default, typically GBK. However, when we develop Web applications, we typically use UTF-8. So you need to set the default character sets.
In Eclipse, click on the menu bar window->preferences, click General/workspace:

Select Other:utf-8 in the Text file encoding area. This way we will use the UTF-8 character encoding by default when we create a new project.

2.4 Set Build Path

in developing Web application, Tomcat is required and we want to add tomcat/lib to the compilation path. Otherwise, you will get the following error when creating the JSP:

The superclass "Javax.servlet.http.HttpServlet" is not found on the Java Build Path

in Eclipse , click the menu bar window->preferences , click java/build path/classpath V Ariables:

Click "New" to create a new variable named "Tomcat Server" and set Path to Tomcat In the installation location of the Lib directory (as shown), click the "OK" button.

Next, add User Libraries. Click java/build path/user Libraries:

Click on the "New ..." button to create a new User Librariesnamed Tomcat Server . Then click on the "Add External JARs ..." button to install and use all of the jars under Tomcal/lib Check (Ctrl + A) and OK. When done, as shown.

Click "OK" to complete the setup.

2.5 Hello World

every time you build a development environment, write a "Hello World" and the success of the show, the mood will naturally become comfortable.

in Eclipse Java EE , Right-click in the blank area of the Project Explorer on the left and click on the New->dynamic Web Project " :

Click "Finish" to finish.

and then in WebContent Right-click on the "new->jsp File"button in the context menuand create a new index.jsp page.

Double hit Open Index.jsp , the hint is wrong, this is the problem we mentioned earlier, and also configured the Build Path. So now we're going to use the set Build path/user Libraries .

in the project manager Right-click on the project root of the HELLOWORKD and tap "Properties". Then, in the Project Properties dialog box that pops up, click "Java Build Path"andswitch to the Libraries tab.

Click "Add Library ..." button:

Double click "User Library",in the pop-up Add Library dialog box, select "Tomcat Server"and click "Finish" /c6> button.

then switch to Order and Export tab, select Tomcat Server . Complete the setup.

As you can see, the errors in the code are gone.

The Web development environment constructs Eclipse-java EE Chapter

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.