Java servlet compilation problems

Source: Internet
Author: User

When we write a java servlet class and compile it, most of the problems occur: javax. servlet package and javax. servlet. the http package does not exist. Most of the answers on the network are as follows:
1. Copy tomcat common \ lib \ servlet. jar (or servlet-api.jar) to java \ jre \ lib \ ext
2. Copy common \ lib \ servlet. jar (or servlet-api.jar) under tomcat to jdk \ lib and add it to the environment variable classpath.
3. Directly compile with eclipse
And so on.
However, many times we have tried the above and found that the compilation is not complete. Why? I think the servlet under the tomcat directory. jar is not the package javax. servlet and javax. servlet. http, the best way is to download a javax directly to the network. servlet package, which contains javax. servlet. copy the downloaded package to jdk \ lib and configure it to the environment variable classpath (or directly download it to jdk \ lib). Try again and maybe it will be OK.
This article is from the "Midnight Hummer" blog

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.