so here is the story: 1. i downloaded the servlet thingy which installed a bunch of classes in a directory called javax. .. i hope this is JSDK?? 2. there is supposed to be startserver.bat file somehere..i dont have it 3. when i compile a servlet class...it gives me an error saying the import not found, specifiically; ------------------- C:\epocketmoney_java>javac HttpGetServlet.java HttpGetServlet.java:1: Package javax.servlet not found in import. import javax.servlet.*; ^ HttpGetServlet.java:2: Package javax.servlet.http not found in import. import javax.servlet.http.*; ^ HttpGetServlet.java:3: Class java.io not found in import. import java.io; ^ HttpGetServlet.java:5: Superclass HttpServlet of class HTTPGetServlet not found. public class HTTPGetServlet extends HttpServlet ^ HttpGetServlet.java:5: Public class HTTPGetServlet must be defined in a file called "HTTPGetServlet.java". public class HTTPGetServlet extends HttpServlet ^ 5 errors -------------- my jsdk is in a folder called c:\javax the code is given below:
4. what am i doing wrong. 5. also there is no folder called webpages/WEB-INF/servlets on my computer where i am supposed to copy the my compiled code. 6. what am i doing wrong??? 7. i am following deitel and deitel chap 19 as usual ... thanks in advance
2. probably because Deitel & Deitel refer to the 'old' school way of doing things with Java Web Server. Tomcat is what you really want.
3. because even though you've downloaded the JSDK, it is not in your CLASSPATH yet.
4. Use Tomcat instead, and don't forget to set your CLASSPATH for compiling.
5. This is not automatically there for you, and in fact, /WEB-INF/servlets is not part of the servlet spec. After installing Tomcat, you will notice a webapps/examples directory, under which you can see an *example* of a WEB-INF directory, however, you shouldn't treat this as a dumping place for servlet classfiles. Read up on web.xml and deployment descriptors to see how to do this the 'new' way.
6. see above
7. D&D's chapter on servlets doesn't really talk about the over-arching structure of webapps.. which is why you are probably confused.
Joined: Aug 14, 2000
thanks.... 1. how do i set the class path ... 2. i do have tomcat 4 on my system....... 3. i am new to web servers regards mansoor my os is w/95