主题:请各位看看这个奇怪的问题 !!
我在tomcat 5.0 下配置servlet时,写了个测试文件,如下:
package test;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Test extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out=response.getWriter();
out.println("<html><body><h1>This is a servlet test.</h1></body></html>");
out.flush();
}
}
在cmd 下 javac Test.java 时却出现
C:\test>javac Test.java
Test.java:4: package javax.servlet does not exist
import javax.servlet.ServletException;
^
Test.java:5: package javax.servlet.http does not exist
import javax.servlet.http.HttpServlet;
^
请问这是怎么回事?(我用的jdk1.4.2_6 ,环境变量设置没问题)
要怎样做才能编译成功?
谢谢 !!
package test;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Test extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out=response.getWriter();
out.println("<html><body><h1>This is a servlet test.</h1></body></html>");
out.flush();
}
}
在cmd 下 javac Test.java 时却出现
C:\test>javac Test.java
Test.java:4: package javax.servlet does not exist
import javax.servlet.ServletException;
^
Test.java:5: package javax.servlet.http does not exist
import javax.servlet.http.HttpServlet;
^
请问这是怎么回事?(我用的jdk1.4.2_6 ,环境变量设置没问题)
要怎样做才能编译成功?
谢谢 !!