my dog learned polymorphism*
The moose likes Servlets and the fly likes Compiling a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Compiling a servlet" Watch "Compiling a servlet" New topic
Author

Compiling a servlet

wayne drummond
Greenhorn

Joined: Jan 15, 2001
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

Joined: Nov 06, 2000
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.
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
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?
you should have added %TOMCAT_HOME%\lib\servlet.jar
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).]


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
wayne drummond
Greenhorn

Joined: Jan 15, 2001
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
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
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
Pl. check with your system.

Regds.
- satya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compiling a servlet