我正在尝试实现基本的 HelloServlet.java 程序。但它似乎产生了这些错误
HelloServlet.java:7: error: cannot find symbol
public class HelloServlet extends HttpServlet {
^
symbol: class HttpServlet
HelloServlet.java:11: error: cannot find symbol
public void init() throws ServletException {
^
symbol: class ServletException
location: class HelloServlet
HelloServlet.java:16: error: cannot find symbol
public void doGet(HttpServletRequest request, HttpServletResponse response)
^
symbol: class HttpServletRequest
location: class HelloServlet
HelloServlet.java:16: error: cannot find symbol
public void doGet(HttpServletRequest request, HttpServletResponse response)
^
symbol: class HttpServletResponse
location: class HelloServlet
HelloServlet.java:17: error: cannot find symbol
throws ServletException, IOException {
^
symbol: class ServletException
location: class HelloServlet
HelloServlet.java:3: error: package javax.servlet does not exist
import javax.servlet.*;
^
HelloServlet.java:4: error: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
7 errors
我已经为 jar 文件添加了 CLASSPATH
nithinchandranp@b-40:~$ echo ${CLASSPATH}
/home/nithinchandranp/ApacheTomcat/apache-tomcat-8.5.34/lib/*
nithinchandranp@b-40:~$
现在我做错了什么?请帮忙..
慕容森
小唯快跑啊
相关分类