package javax.servlet do es not exist 怎么回事?(100分)

  • 主题发起人 主题发起人 fanciex
  • 开始时间 开始时间
F

fanciex

Unregistered / Unconfirmed
GUEST, unregistred user!
用JCreator2.5编译一个Servlet出错如下,用jb8可编译。我想可能是jCreator配置有问题,如何解决呀?
--------------------Configuration: JDK version 1.4 <Default>--------------------
C:/Tomcat 4.1/webapps/examples/WEB-INF/classes/HelloWorldExample.java:8: package javax.servletdo
es not exist
import javax.servlet.*;
^
C:/Tomcat 4.1/webapps/examples/WEB-INF/classes/HelloWorldExample.java:9: package javax.servlet.httpdo
es not exist
import javax.servlet.http.*;
^
C:/Tomcat 4.1/webapps/examples/WEB-INF/classes/HelloWorldExample.java:17: cannot resolve symbol
symbol : class HttpServlet
location: class HelloWorldExample
public class HelloWorldExample extends HttpServlet {
^
C:/Tomcat 4.1/webapps/examples/WEB-INF/classes/HelloWorldExample.java:20: cannot resolve symbol
symbol : class HttpServletRequest
location: class HelloWorldExample
public voiddo
Get(HttpServletRequest request,
^
C:/Tomcat 4.1/webapps/examples/WEB-INF/classes/HelloWorldExample.java:21: cannot resolve symbol
symbol : class HttpServletResponse
location: class HelloWorldExample
HttpServletResponse response)
^
C:/Tomcat 4.1/webapps/examples/WEB-INF/classes/HelloWorldExample.java:22: cannot resolve symbol
symbol : class ServletException
location: class HelloWorldExample
throws IOException, ServletException
^
6 errors
Process completed.
 
把j2ee包放到你的classpath里就行了
jb里有,用winrar打开可以看到javax包里的servlet类。。。
 
设置一下你的ClassPath就可以了,在Classpath中加上你的servlet.jar文件所在的目录名和
这个文件的名称以及扩展名
 
%tomcat_home%/common/lib下有个servlet.jar
加入到jcreator的classpath中去
 
多人接受答案了。
 
后退
顶部