aspose file tools*
The moose likes Servlets and the fly likes Cannot compile servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Cannot compile servlet" Watch "Cannot compile servlet" New topic
Author

Cannot compile servlet

Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
HI,
I'm just starting on JSP and Servlets and I have the JSWDK-1.0 installed and running (it was very easy to set up).
I have no difficulties running JSP's with includes, directives expressions, etc.
However when I tried to compile this example servlet from a web tutorial

I get 6 errors because the import statements don't seem to work.
Any ideas?
Thanks,

Terry Doyle


Raising Flares debut album 'Ignition' out now

http://www.raisingflares.com

Terry Doyle <br />SCPJ 1.4 , SCWCD , SCMAD(Beta)
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Yup.
1. Are you really trying to compile them the servlet - i.e. use the "Javac" command? Or are you thinking that they work the same way that JSPs do? They don't. Think of them as Java Applications.
2. Assuming you're compiling properly, do you have the CLASSPATH set up properly? You didn't mention which imports were failing, but if java.io.* is OK and the javax.servlet imports fail, it's because your classpath for javac doesn't include the servlet.jar file from your JSWDK distribution.


Customer surveys are for companies who didn't pay proper attention to begin with.
Johannes de Jong
tumbleweed
Bartender

Joined: Jan 27, 2001
Posts: 5089
HI Terence see Servlets and JavaServer Pages (JSP) 1.0: A Tutorial
Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
HI,
Thank you both for your quick answers.
Tim:
Yes I'm using the javac command - I got that far
The class path was the trouble. When following the instructions in the faq I put the servlet.jar in but with the JDK path not the JSWDK path.
I set that right and now it compiles fine.
JDJ:
Guess where I got the example code??? Yes. I have just started that tutorial.

Thanks again to both of you.

Terry Doyle
[This message has been edited by Terence Doyle (edited September 11, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot compile servlet