Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compile Servlet class

 
Mike Yu
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Dilip kumar
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure you've set the classpath appropriately

Regards,
Saket
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, first of all do you have servlet api with you?
 
Mike Yu
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for your response.
What I was told is to use J2SE to compile Servlet.
 
Priya Soparkar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic