Eu criei os diretórios corretamente, copiei o código e agora não compila e retorna esse erro. Estou compilando pelo terminal usando o javac.
package com.example.web;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class BeerSelect extends HttpServlet {
public void doPost ( HttpServletRequest request,
HttpServletResponse response )
throws IOException , ServletException{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("Beer Selection Advice <br>");
String c = request.getParameter("color");
out.println("<br> Got beer color " + c);
}
}
Stacktrace no terminal:
src/com/example/web/BeerSelect.java:3: error: package javax.servlet does not exist import javax.servlet.*; ^ src/com/example/web/BeerSelect.java:4: error: package javax.servlet.http does not exist import javax.servlet.http.*; ^ src/com/example/web/BeerSelect.java:7: error: cannot find symbol public class BeerSelect extends HttpServlet { ^ symbol: class HttpServlet src/com/example/web/BeerSelect.java:9: error: cannot find symbol public void doPost ( HttpServletRequest request, ^ symbol: class HttpServletRequest location: class BeerSelect src/com/example/web/BeerSelect.java:10: error: cannot find symbol HttpServletResponse response ) ^ symbol: class HttpServletResponse location: class BeerSelect src/com/example/web/BeerSelect.java:11: error: cannot find symbol throws IOException , ServletException{ ^ symbol: class ServletException location: class BeerSelect 6 errors