File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error when compiling the servlet Page 81 of HFSJ

 
Harish Yerneni
Ranch Hand
Posts: 94
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Nitish Bahadur
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic