• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

compile Servlet class

 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure you've set the classpath appropriately

Regards,
Saket
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all for your response.
What I was told is to use J2SE to compile Servlet.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic