# Compiling a servlet

wayne drummond
Greenhorn
Posts: 9
I'm having a problem compiling the hello world sample servlet.
I getting an error whenever I try to compile the java file. For one reason or another I'm getting an error stating that the javax.servlet.*; package does not exist. I've tried compiling it in TextPad,the command line, and in JBuilder but no luck. Also I've tried running a servlet that came with Tomcat and it works just fine, so I tried to compile the java file and that also failed. Can anyone help or point me in the right direction. Thanks

Cynthia Yao
Ranch Hand
Posts: 92
Well, the first thing I can think of is classpath. When u use JBuilder, either add where tomcat servlet.jar in u project library. Or edit u autoexec.bat to include the jar file.

Ranch Hand
Posts: 5040
when the compiler can't find a package, most times
it has to do with your classpath and not the editor.
having said that, whats' your classpath?
to your classpath and then compile the servlet.
hth....
regds.
- satya

OOPS.....i din't know i was competing with you Cinthia....

[This message has been edited by Madhav Lakkapragada (edited February 01, 2001).]

wayne drummond
Greenhorn
Posts: 9
Thanks for the help I figured as much. I've been tinkering with my classpath and I'm not sure if it is correct, however here is a copy of what I have.
E:\Oracle\Ora81\orb\classes\yoj.jar;E:\Oracle\Ora81\orb\classes\share.zip;C:\jdk1.3\bin;C:\JAVA;C:\Java\JavaRanchCommon.zip;C:\jakarta-tomcat-3-2-1\lib\servlet.jar;C:\jakarta-tomca t-3-2-1\lib\jasper.jar;c:\java\jakarta-servletapi-3.2.zip;C:\jakarta-tomcat-3-2-1\lib;c:\jdk1.3\lib\tools.jar

Ranch Hand
Posts: 5040
E:\Oracle\Ora81\orb\classes\yoj.jar;E:\Oracle\Ora81\orb\classes\share.zip;C:\jdk1.3\bin;C:\JAVA;C:\Java\JavaRanchCommon.zip;C:\jakarta-tomcat-3-2-1\lib\servlet.jar;C:\jakarta-to mcat-3-2-1\lib\jasper.jar;c:\java\jakarta-servletapi-3.2.zip;C:\jakarta-tomcat-3-2-1\lib;c:\jdk1.3\lib\tools.jar
IMO, I would limit it to have the bare minimum....something like this:
E:\Oracle\Ora81\orb\classes\yoj.jar;E:\Oracle\Ora81\orb\classes\share.zip;C:\jakarta-tomcat-3-2-1\lib\servlet.jar;C:\jakarta-tomca
t-3-2-1\lib\jasper.jar;C:\jdk1.3\lib\tools.jar
Also make sure that tomcat_home is C:\jakarta-tomcat-3-2-1
Somehow, till know I have seen something like C:\jakarta-tomcat-3.2.1