File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes compile Servlet class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "compile Servlet class" Watch "compile Servlet class" New topic

compile Servlet class

Mike Yu
Ranch Hand

Joined: Nov 17, 2001
Posts: 175

I was asked to write a Servlet, and to run it. But there is no any IDE for compiling the servlet. I was told that I can use J2SE to compile a servlet.

Can someone tell me how to do it?

Thanks,<br />Mike
Dilip kumar
Ranch Hand

Joined: Oct 16, 2000
Posts: 360
You don't need IDE to compile servlets. IDE are used to write servlets/JSPs/HTML/regular java classes in a very convenient way. Compile the servlet the way you compile regular java classes using javac command.
Saket Barve
Ranch Hand

Joined: Dec 19, 2002
Posts: 229
Make sure you've set the classpath appropriately

Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Hey, first of all do you have servlet api with you?
Mike Yu
Ranch Hand

Joined: Nov 17, 2001
Posts: 175
Thank you all for your response.
What I was told is to use J2SE to compile Servlet.
Priya Soparkar

Joined: Apr 28, 2004
Posts: 4
Well , the major diff between using an IDE and compiling the java resources from say command prompt is setting the classpath entries.

When you use some IDE(e.g Eclipse), the IDE takes care of the classpath and environment entries.
Like the JDK path etc is taken care when u install the IDE and specify the JDK path for the first time.

But for external dependent jar files , we need to add them in the build classpath entries in the IDE.

e.g When you are writing a servlet using an IDE, for compiling your servlet class , you need to put your servlet.jar file in your Add external libraries (dependencies )tab.

Wheread when you try to compile your java resource from command line ,here your servket class , you need to set the complete servlet.jar path in your environment entries (as classpath)and compile your servlet class like any other java resouce.

Hope this helps ,

I agree. Here's the link:
subject: compile Servlet class
It's not a secret anymore!