This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

compiling servlets using tomcat  RSS feed

 
Danish Shaukat
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!
How do i compile servlets using tomcat.
Any documentation available on this any where.
Regards
Danish Shaukat
 
Phil Hanna
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To compile servlets, all you need is servlet.jar somewhere in your classpath. Typically, this jar file is found in the lib directory of your servlet engine. For example, in Tomcat 3.x, it is %TOMCAT_HOME%/lib/servlet.jar. In Tomcat 4.0, it is %TOMCAT_HOME%/common/lib/servlet.jar. It shouldn't be hard to find.
You can compile MyServlet.java with this command:
javac -classpath .;path_to_jar/servlet.jar MyServlet.java
The servlet source code can be anywhere. The .class file should be placed in /WEB-INF/classes or the appropriate subdirectory, if it is in a package.
------------------
Phil Hanna
Author of :
JSP: The Complete Reference
Instant Java Servlets
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!