• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

javax.servlet.http.* missing?  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying to go through the head first servlets & jsp book
i downloaded tomcat for the first time and j2sdk1.4.2_06
i amtrying to do the first exercise and i keep getting the following error
i dont know where or if i have the class javax.*
please help

C:\project1\src>javac -classpath tomcat/common/lib/servlet-api.jar -d classes Ch
Servlet.java
error: cannot read: ChServlet.java
1 error

C:\project1\src>javac -classpath tomcat/common/lib/servlet-api.jar -d classes Ch
1Servlet.java
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 resolve symbol
symbol : class HttpServlet
location: class Ch1Servlet
public class Ch1Servlet extends HttpServlet {
^
Ch1Servlet.java:7: cannot resolve symbol
symbol : class HttpServletRequest
location: class Ch1Servlet
public void doGet(HttpServletRequest request,
^
Ch1Servlet.java:8: cannot resolve symbol
symbol : class HttpServletResponse
location: class Ch1Servlet
HttpServletResponse response)
^
5 errors

C:\project1\src>
 
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you sure you have j2ee.jar in your classpath?
 
Sheriff
Posts: 12343
201
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The path you gave is relative. Is the tomcat directory under c:/project/src? If not, then you need to give the absolute path to the servlet-api.jar.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!