This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Servlets and the fly likes JSDK start and stop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSDK start and stop" Watch "JSDK start and stop" New topic

JSDK start and stop

mansoor iqbal
Ranch Hand

Joined: Aug 14, 2000
Posts: 91
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 gives me an error saying the import not found, specifiically;
C:\epocketmoney_java>javac Package javax.servlet not found in import.
import javax.servlet.*;
^ Package javax.servlet.http not found in import.
import javax.servlet.http.*;
^ Class not found in import.
^ Superclass HttpServlet of class HTTPGetServlet not found.
public class HTTPGetServlet extends HttpServlet
^ Public class HTTPGetServlet must be defined in a file called "".
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
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

1. depends on what you meant by 'servlet thingy'

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.
mansoor iqbal
Ranch Hand

Joined: Aug 14, 2000
Posts: 91
1. how do i set the class path ...
2. i do have tomcat 4 on my system.......
3. i am new to web servers
my os is w/95
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

I forget the exact syntax for win9x, but you need to set your classpath in autoexec.bat, and because of this, you will also need to restart your computer for it to take effect.

It is *something* like
set CLASSPATH = d:\Tomcat4.0\common\lib\servlet.jar

An alternative is to send it into to javac as a parameter (this is the method I prefer, and what the good IDE's use) so that your CLASSPATH does not become clogged with old versions of jars.

javac -classpath "d:\Tomcat4.0\common\lib\servlet.jar"
I agree. Here's the link:
subject: JSDK start and stop
It's not a secret anymore!