Bookmark Topic Watch Topic
  • New Topic

setting classpath

 
ks karthe
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi everyone,

i am new to servlet
i am reading K&B book for SCWCD.
i tried to run the program (chapter 1 ,page no 30)
but its showing 5 errors


Ch1Servlet.java:1: package javax.Servlet does not exist
import javax.Servlet.*;
^
Ch1Servlet.java:2: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
Ch1Servlet.java:5: cannot find symbol
symbol: class HttpServlet
public class Ch1Servlet extends HttpServlet
^
Ch1Servlet.java:7: cannot find symbol
symbol : class HttpServletRequest
location: class Ch1Servlet
public void goGet(HttpServletRequest request, HttpServletResponse response)
throws IOException
^
Ch1Servlet.java:7: cannot find symbol
symbol : class HttpServletResponse
location: class Ch1Servlet
public void goGet(HttpServletRequest request, HttpServletResponse response)
throws IOException

i set the classpath as said in the book.
i read some other posts regarding this probelm and tried to solve
but in vain.

please some one help
thanks in advance
thank you all
 
Antonio Tercero
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Report post to moderator
If your are new to servlets, you should download and install Netbeans IDE first:
it comes with tomcat,glassfish and it's all configured.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
Include the servlet-api.jar file in your lib folder.
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

You are missing the servlet.jar in your CLASSPATH environmental variable.

Cheers,
Raj.
 
Ravi Singh
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please add servlet-api.jar present in your tomcats common/lib folder and add it to the classpath by using environment varables settings in your system.

Problem is tomacat is not able to find the APIs related to servlets since they are not on classpath .

Above solution will work for any web project running inside Tomcat
 
ks karthe
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Report post to moderator
thank you everyone
now it compiled fine , but still its showing HTTP status 404 error
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
The page you are trying to access is not located. Try restarting Tomcat or check if you really have the jsp/html page that you are accessing. Look at your web.xml.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Closing duplicate
 
    Bookmark Topic Watch Topic
  • New Topic