简体   繁体   English

javax.servlet不存在

[英]javax.servlet does not exist

I'm using linux for the first time to develop servlet/jsp. 我第一次使用linux开发servlet / jsp。 When I tried to compile a simple servlet, I got javax.servlet does not exist. 当我尝试编译一个简单的servlet时,我发现javax.servlet不存在。 What should I do? 我该怎么办? I know it's a problem with the path but how do I correct it without overwriting values already in the path. 我知道这是路径的问题,但是如何在不覆盖路径中已有值的情况下进行纠正。

Where should I place the .class servlet? 我应该在哪里放置.class servlet? The book I'm reading about servlets is saying one thing, the I find yet other things online. 我正在阅读的有关servlet的书说的是一件事,而我在网上却发现了其他东西。 I don't want to mess the settings up. 我不想弄乱设置。 I found and online poster suggesting to create a folder under /usr/share/tomcat6/webapp and move all the .class there and it will work without any further settings. 我发现在线海报提示我在/ usr / share / tomcat6 / webapp下创建一个文件夹,然后将所有.class移到那里,这样无需任何进一步设置即可工作。 Is this true? 这是真的?

Thank you very much, Mike 非常感谢迈克

Have you added servlet-api.jar to your classpath? 您是否已将servlet-api.jar添加到类路径中? if not, this jar should be present in your classpath in-order to work with servlets. 如果不是,则此jar应该出现在您的类路径中,以便与servlet一起使用。

To avoid this compilation error, 1. copy the jar file: tomcat\\common\\lib\\servlet-api.jar or tomcat\\lib\\servlet-api.jar 2. paste it to Program Files\\Java\\jdk1.6.0_10\\jre\\lib\\ext 为避免此编译错误,1.复制jar文件:tomcat \\ common \\ lib \\ servlet-api.jar或tomcat \\ lib \\ servlet-api.jar 2.将其粘贴到Program Files \\ Java \\ jdk1.6.0_10 \\ jre \\ lib \\ ext

/// your installation path may slightly differ. ///您的安装路径可能会略有不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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