如何设置类路径和路径以在ubuntu 18.04上运行servlet”

时间:2019-06-16 09:13:05

标签: java servlets

我花了几个小时在线尝试一些东西,以使我的servlet运行。但不可能。

   nsword@nsword:~/ref$ javac Login.java
Login.java:5: error: cannot find symbol
public class Login extends HttpServlet {
                           ^
  symbol: class HttpServlet
Login.java:7: error: cannot find symbol
protected void doPost(HttpServletRequest request, HttpServletResponse response)
                      ^
  symbol:   class HttpServletRequest
  location: class Login
Login.java:7: error: cannot find symbol
protected void doPost(HttpServletRequest request, HttpServletResponse response)
                                                  ^
  symbol:   class HttpServletResponse
  location: class Login
Login.java:8: error: cannot find symbol
throws ServletException, IOException
       ^
  symbol:   class ServletException
  location: class Login
Login.java:2: error: package javax does not exist
import javax.*;
^
Login.java:3: error: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
Login.java:15: error: cannot find symbol
RequestDispatcher rs = request.getRequestDispatcher("Welcome");
^
  symbol:   class RequestDispatcher
  location: class Login
Login.java:21: error: cannot find symbol
RequestDispatcher rs = request.getRequestDispatcher("index.html");
^
  symbol:   class RequestDispatcher
  location: class Login
8 errors

它甚至不编译。 显示8个错误 我认为找不到javax.servlet包 稍后我需要在tomcat上运行它。

0 个答案:

没有答案