aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Error when compiling the servlet Page 81 of HFSJ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Error when compiling the servlet Page 81 of HFSJ " Watch "Error when compiling the servlet Page 81 of HFSJ " New topic
Author

Error when compiling the servlet Page 81 of HFSJ

Harish Yerneni
Ranch Hand

Joined: Sep 15, 2004
Posts: 94
Hello,

When I am trying to compile the servlet on page 81, I am getting the following error. Here are the details

D:\MyProjects\beerV1>C:\j2sdk1.4.2_04\bin\javac -classpath c:/Program*/Apache*/Tomcat*/common/lib/servlet-api.jar:classes:. -d classes src/com/example/web/BeerSelect.java

output
*****************************************************************************
src/com/example/web/BeerSelect.java:3: package javax.servlet does not exist
import javax.servlet.*;
^
src/com/example/web/BeerSelect.java:4: package javax.servlet.http does not exist import javax.servlet.http.*;
^
src/com/example/web/BeerSelect.java:7: cannot resolve symbol
symbol : class HttpServlet
location: class com.example.web.BeerSelect
public class BeerSelect extends HttpServlet{
^
src/com/example/web/BeerSelect.java:9: cannot resolve symbol
symbol : class HttpServletRequest
location: class com.example.web.BeerSelect
public void dopost(HttpServletRequest request, HttpServletResponse response)
^
src/com/example/web/BeerSelect.java:9: cannot resolve symbol
symbol : class HttpServletResponse
location: class com.example.web.BeerSelect
public void dopost(HttpServletRequest request, HttpServletResponse response)
^
src/com/example/web/BeerSelect.java:10: cannot resolve symbol
symbol : class ServletException
location: class com.example.web.BeerSelect
throws IOException, ServletException {
^
6 errors
*****************************************************************************

I can understand that the compiler is unable to find the servlet api's. I have development environment set up on D drive and deployment environment set up on C drive.

Can someone help me?

Thank you,

Harish


SCJP 1.4 | SCWCD 1.4 | SCJD (WIP)
Nitish Bahadur
Ranch Hand

Joined: Aug 25, 2003
Posts: 118
Add servlet-api.jar to your class path. You can find this in $tomcat-home\common\lib directory.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error when compiling the servlet Page 81 of HFSJ