为什么无法编译servlet?怪!
我的系统无法编译servlet,但是可以执行tomcat的servlet的实例。编译出现如下错误。
---------- javac ----------
HelloWorldExample.java:8: package javax.servlet does not exist
import javax.servlet.*;
^
HelloWorldExample.java:9: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
HelloWorldExample.java:17: cannot resolve symbol
symbol : class HttpServlet
location: class HelloWorldExample
public class HelloWorldExample extends HttpServlet {
^
HelloWorldExample.java:20: cannot resolve symbol
symbol : class HttpServletRequest
location: class HelloWorldExample
public void doGet(HttpServletRequest request,
^
HelloWorldExample.java:21: cannot resolve symbol
symbol : class HttpServletResponse
location: class HelloWorldExample
HttpServletResponse response)
^
HelloWorldExample.java:22: cannot resolve symbol
symbol : class ServletException
location: class HelloWorldExample
throws IOException, ServletException
^
6 errors
输出完成 (耗时 0 秒) - 正常终止
我的环境变量里面有:%CATALINA_HOME%\common\lib\servlet.jar 呀。高手救命。