为什么我设置
set classpath=>"C:\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar"
然后再javac HelloServlet.java
时会有!!
HelloServlet.java:2: 软件包 javax.servlet 不存在
import javax.servlet.*;
^
HelloServlet.java:3: 软件包 javax.servlet.http 不存在
import javax.servlet.http.*;
^
HelloServlet.java:4: 找不到符号
符号: 类 HttpServlet
public class HelloServlet extends HttpServlet{
^
HelloServlet.java:5: 找不到符号
符号: 类 HttpServletRequest
位置: 类 HelloServlet
public void doGet(HttpServletRequest request,HttpServletResponse respons
e)throws ServletException,IOException{
^
HelloServlet.java:5: 找不到符号
符号: 类 HttpServletResponse
位置: 类 HelloServlet
public void doGet(HttpServletRequest request,HttpServletResponse respons
e)throws ServletException,IOException{
^
HelloServlet.java:5: 找不到符号
符号: 类 ServletException
位置: 类 HelloServlet
public void doGet(HttpServletRequest request,HttpServletResponse respons
e)throws ServletException,IOException{
^
6 错误
但是javac -cp "C:\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar" HelloServlet.java
时却能正常通过编译!!!!
请教了!!!