ERROR : javax.servlet does not exist
You should use ;
to separate classpath entries in Windows
javac -cp .;C:\Tomcat7\lib\servlet-api.jar DBConnnection.java
.
but, you used a comma ,
. Change comma to semicolon
Note : *nix family environments use colon :
to seperate classpath entries
woodhead92
Updated on June 04, 2022Comments
-
woodhead92 almost 2 years
I have checked almost all the posts possible for the error that I'm getting. Ive edited almost all the ENVIRONMENT VARIABLES as given online. These are my environment variables :
ANT_HOME = C:\Ant9;C:\Tomcat7\lib\servlet-api.jar
CLASSPATH = C:\Program Files\Java\jdk1.6.0_24\bin;C:\Program Files\Java\jre6\bin;C:\Tomcat7\lib\servlet-api.jar;.
JAVA_HOME = C:\Program Files\Java\jdk1.6.0_24
PATH = C:\Program Files\Java\jdk1.6.0_24\bin
TOMCAT_HOME = C:\Tomcat7
C:\Tomcat7\webapps\DBConnection\WEB_INF\classes\DBConnection>javac -cp .,C:\Tomc at7\lib\servlet-api.jar DBConnnection.java DBConnnection.java:4: package javax.servlet does not exist import javax.servlet.*; ^ DBConnnection.java:5: package javax.servlet.http does not exist import javax.servlet.http.*; ^ DBConnnection.java:11: cannot find symbol symbol: class HttpServlet public class DBConnnection extends HttpServlet ^ DBConnnection.java:14: cannot find symbol symbol : class HttpServletRequest location: class DBConnection.DBConnnection public void doGet(HttpServletRequest request, HttpServletResponse response) th rows ServletException, IOException ^ DBConnnection.java:14: cannot find symbol symbol : class HttpServletResponse location: class DBConnection.DBConnnection public void doGet(HttpServletRequest request, HttpServletResponse response) th rows ServletException, IOException ^ DBConnnection.java:14: cannot find symbol symbol : class ServletException location: class DBConnection.DBConnnection public void doGet(HttpServletRequest request, HttpServletResponse response) th rows ServletException, IOException ^ DBConnnection.java:53: cannot find symbol symbol : class EmployeeInformation location: class DBConnection.DBConnnection EmployeeInformation empInfo = new EmployeeInformation(); ^ DBConnnection.java:53: cannot find symbol symbol : class EmployeeInformation location: class DBConnection.DBConnnection EmployeeInformation empInfo = new EmployeeInformation(); ^ DBConnnection.java:13: method does not override or implement a method from a sup ertype @Override ^ 9 errors
Im really baffled as to how to proceed! Been stuck at this point!!
-
woodhead92 about 10 yearsWorked perfectly. Feel so silly for overlooking that!
-
Keerthivasan about 10 yearsGlad, it worked :) . Please accept the answer to close the question.