Forums Register Login

compile Servlet class

+Pie Number of slices to send: Send
Hi,

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?
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Make sure you've set the classpath appropriately

Regards,
Saket
+Pie Number of slices to send: Send
Hey, first of all do you have servlet api with you?
+Pie Number of slices to send: Send
Thank you all for your response.
What I was told is to use J2SE to compile Servlet.
+Pie Number of slices to send: Send
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 ,

Thanks,
Priya
I'm not sure if I approve of this interruption. But this tiny ad checks out:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 978 times.
Similar Threads
Compile a Servlet
Servlets And Jsp
How to convert jsp to servlet
compiling and deploying into Tomcat
Compile Servlet File Online
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 22:10:27.