I'm compiling a Java file with the Javax.servlet package provided under a servlet rookie tutorial, and the mutation is wrong,
Import java.io.*;
Import javax.servlet.*;
Import javax.servlet.http.*;
public class HelloWorld extends HttpServlet {
public void doget (HttpServletRequest request, httpservletresponse response)
Throws IOException, Servletexception
{
The following issues occur:
Helloworld.java:2: Package Javax.servlet does not exist
Import javax.servlet.*;
^
Helloworld.java:3: Package javax.servlet.http does not exist
Import javax.servlet.http.*;
^
Helloworld.java:6: Symbol not found
Symbol: Class HttpServlet
public class HelloWorld extends HttpServlet {
^
Helloworld.java:7: Symbol not found
Symbol: Class HttpServletRequest
Location: Class HelloWorld
public void doget (HttpServletRequest request, httpservletresponse response)
^
Helloworld.java:7: Symbol not found
Symbol: Class HttpServletResponse
Location: Class HelloWorld
public void doget (HttpServletRequest request, httpservletresponse response)
^
Helloworld.java:8: Symbol not found
Symbol: Class Servletexception
Location: Class HelloWorld
Throws IOException, Servletexception
The reason is that the Java compiler did not find the package javax.servlet.
Workaround:
Copy a Servlet-api.jar package from the Tomcat Lib directory to the "Jdk\jre\lib\ext" directory
In the case of cases where the package is not found, it is possible to put the found package under Jdk\jre\lib\ext and then compile it to pass.
Learning the path of the servlet--javax-servlet not exist