An error occurred after Eclipse opened the project: the import Javax.servlet cannot be resolved

Source: Internet
Author: User
Tags apache tomcat

An error occurred after opening the project with Eclipse:

The import Javax.servlet cannot be resolved

Java and javax are Java API (application programming Interface) package, Java is the core package, javax x is extension meaning, that is, the expansion package

"Problem Analysis"

No Servlet-api.jar this bag.

In general, we import other people's projects, on other people's machine he configured the server, is generally tomcat, and in the process of copying the server library will not be copied with the project, Unless someone else has copied the Tomcat library to Web-inf\lib.


"Solutions"

Programme one:

Find this package under the Lib directory of Tomcat

Then in Eclipse, right-click the project, choose Build Path---Configure build path ...-Libraries Add External JARs ..., find Tomcat on your computer Install the path, under the Lib folder, check "Servlet-api.jar", add click "OK", it's OK

Scenario Two:

Locate Servlet-api.jar under the Tomcat installation path (for example: F:\JavaWebDev\apache-tomcat-8.0.32), and copy it to the project's Webcontent\web-inf\lib directory, and then refresh (F5) The project, it's ready.

Programme III:

Right-click Java Build Path, Add Library, Project--Properties----server Runtime, Next--Select your Server (my "Apache Tomcat v8.0"), Finish

"See" http://slf-1983.blog.163.com/blog/static/29902363201191555019355/

An error occurred after Eclipse opened the project: the import Javax.servlet cannot be resolved

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.