我非常需要建议我在这里出错了
我有servlet-api.jar @E:\ J2EE \ apache-tomcat-6.0.18 \ lib
E:\ J2EE \ Apache的Tomcat的6.0.18 \ lib中\ servlet的api.jar文件
我正在尝试运行一个Servlet类" TouchServlet.java"在
E:\ J2EE \ Apache的Tomcat的6.0.18 \ web应用\ TouchServlet \ SRC \ COM \ saravanansivaji \的servlet \ TouchServlet.java
从命令提示符开始,
E:\ J2EE \ apache-tomcat-6.0.18 \ webapps \ TouchServlet> javac -classpath E:\ j2ee \ apach e-tomcat-6.0.18 \ lib \ servlet-api.jar src \ com \ saravanansivaji \ servlet \ TouchServlet 的.java
注意:我从E:\ J2EE \ apache-tomcat-6.0.18 \ webapps \ TouchServlet执行
以下是目录结构
E:\ J2EE \ Apache的Tomcat的6.0.18 \ web应用\ TouchServlet> 我在这里
E:\ J2EE \ Apache的Tomcat的6.0.18 \ web应用\ TouchServlet \ SRC \ COM \ saravanansivaji \的servlet \ TouchServlet.java
E:\ J2EE \ Apache的Tomcat的6.0.18 \ lib中\ servlet的api.jar文件
如果我编译,我收到以下错误
E:\J2EE\apache-tomcat-6.0.18\webapps\TouchServlet>javac -classpath E:\j2ee\apach
e-tomcat-6.0.18\lib\servlet-api.jar src\com\saravanansivaji\servlet\TouchServlet
.java
src\com\saravanansivaji\servlet\TouchServlet.java:4: package java.servlet does n
ot exist
import java.servlet.*;
^
src\com\saravanansivaji\servlet\TouchServlet.java:5: package java.servlet.http d
oes not exist
import java.servlet.http.*;
^
src\com\saravanansivaji\servlet\TouchServlet.java:7: cannot find symbol
symbol: class HttpServlet
class TouchServlet extends HttpServlet
^
src\com\saravanansivaji\servlet\TouchServlet.java:9: cannot find symbol
symbol : class HttpServletRequest
location: class com.saravanansivaji.servlet.TouchServlet
public void doGet(HttpServletRequest request, HttpServletResponse respon
se)
^
src\com\saravanansivaji\servlet\TouchServlet.java:9: cannot find symbol
symbol : class HttpServletResponse
location: class com.saravanansivaji.servlet.TouchServlet
public void doGet(HttpServletRequest request, HttpServletResponse respon
se)
^
src\com\saravanansivaji\servlet\TouchServlet.java:10: cannot find symbol
symbol : class ServletException
location: class com.saravanansivaji.servlet.TouchServlet
throws ServletException, IOException {
^
6 errors
答案 0 :(得分:0)
尝试以下
E:\ J2EE \ Apache的Tomcat的6.0.18 \ web应用\ TouchServlet> javac -classpath“E:\ j2ee \ apache-tomcat-6.0.18 \ lib \ servlet-api.jar”TouchServlet.java