File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSDK start and stop" Watch "JSDK start and stop" New topic
Author

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 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
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
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
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" servletSource.java
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSDK start and stop
 
Similar Threads
New to servlets
beginner question:error 404 servlet not available in Tomcat
problem with compiling servlets
still cant compile the code
Can Someone help me out?