| Author |
Error while compiling
|
thirun pavan
Greenhorn
Joined: Jun 27, 2007
Posts: 22
|
|
Hi All,
I am trying to learn J2EE using the head first servlet and JSP book, and while I was trying their first example there I wrote the following command:
then I got the following errors:
I am sure I have Java installed on my machine, so can someone please help me and tell me what exactly I am doing wrong here?
Thanks for your time
|
 |
Greg Charles
Bartender
Joined: Oct 01, 2001
Posts: 2542
|
|
Yes, the Java compiler seems to be working. Otherwise you'd be getting a whole different kind of error. The only two possibilities I can think of are:
You don't have the servlet-api.jar in the location you have specified. Even a small typo would cause this problem.The servelet-api.jar doesn't contain those packages and classes. As far as I know, it should, but it's easy to open up the jar and look for yourself.
|
 |
Charbel Keyrouz
Ranch Hand
Joined: Jun 10, 2005
Posts: 46
|
|
The servlet-api.jar does contain HttpServlet, HttpServletRequest and HttpServletResponse.
The problem is in the path, make sure that you are pointing to the right path that contains the mentioned jar above.
|
 |
David Curry
Greenhorn
Joined: Jun 11, 2009
Posts: 5
|
|
Just to be a bit more specific:
HttpServlet, HttpServletRequest, and HttpServletResponse are all in the J2EE library. It may be that you only have Java SE (Java standard edition) installed. Be sure to download J2EE and place the j2ee.jar file in your classpath.
Note: The "javax" in import javax.servlet.* is a sure sign that it is J2EE package.
|
 |
thirun pavan
Greenhorn
Joined: Jun 27, 2007
Posts: 22
|
|
Thanks all for your help and support...highly appreciated
I found my mistake and it was in the path to the jar file, now everything is working fine
Thanks again
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32712
|
|
David Curry wrote:The "javax" in import javax.servlet.* is a sure sign that it is J2EE package.
No, it isn't. There are J2SE classes in javax.* packages.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Swing classes being the best known.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Charbel Keyrouz
Ranch Hand
Joined: Jun 10, 2005
Posts: 46
|
|
|
These classes do not exist in the J2EE packages they only exist in the servlet-api.jar
|
 |
 |
|
|
subject: Error while compiling
|
|
|