简体   繁体   中英

I can't compile my servlet code

I am having big problems compiling java servlets. As far as I can see, I've done everything I need to do, I've installed Tomcat 7 correctly, and Tomcat is working. As I understand, I need to add servlet.jar package to my classpath.

I've done this, by editing the classpath environment variables:

CLASSPATH=C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\servlet-api.jar

Unfortunately, still no luck, I can't compile java servlets, and I am still get warnings about missing symbols for javax.servlets.

I am using Window 7. Any ideas?

Tomcat already comes with Servlet related stuff jar files. You don't need to worry about them. You have make them available for your application to compile by adding those in your classpath. But not including into the application build.

If your compiler complains about javax.servlets. so you are missing the Java EE jar in your classpath. You need to add the Java EE jar file to your classpath (the application classpath). You can download them following this . But make sure you do not include them into your build.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM