Im just starting out on servlets. Downloaded the j2ee sdk5 from the sun website and installed it. Wrote the first program from the K&B book and when i tried to compile it using javac it throws me 5 errors saying package javax.servlet, HttpServletRequest,HttpServletResponse not found. What could be wrong.
I tried setting the class path all over again. still no use. other j2se files compile fine and i have a problem only with this file
you need to include either j2ee.jar or servlets.jar on your classpath.
the JEE jar contains all of the required classes including servlets and ejbs, servlets just has the servlet and JSP stuff.
Joined: Jul 25, 2006
Ya thanks... ran a search on that and found out how to get it done. Finally the code compiled n ran properly... But is there an easier way out of this. I mean,can the .jar file be permanently included in the path rather than us having to type it manually everytime?
Yes! In windows enviornment you can copy the .jar file location directly to the CLASSPATH system variable so that you dont need to include them again and again.
YOu need to
goto control panel->system->select advanced Tab under this you will find 2 buttons at bottom side of the dialog click on enviornment variables->select the CLASSPATH varible from system varibles list if it is not there then create one and insert the location of the .jar file, now its done!