Hello! i am new to the servlets world. plz any body answer the following. 1. How to compile servlets from TextPade Or command line? 2. What are the requirements like JDK or JSDK, web server etc? 3. How to configure the relevant paths? thnx. Naveed
All you need for compiling servlets is the latest sdk from Sun. You could also download the latest version of Jakarta's Tomcat to use as a servlet/jsp container. However, in order to run your servlet successfully, the directory structure that it is placed in has to comply with the servlet 2.3 specification. Put your classes in a directory structure like this: WebApplicationDirectory/WEB-INF/classes/com/yourHost/className (com/yourHost refers to your classes package) Put your deployment descriptor (web.xml file) like this: WebApplicationDirectory/WEB-INF/web.xml If you are using Tomcat, put your WebApplicationDirectory like this: jakarta-tomcat-4.0.6-LE-jdk14\webapps\WebApplicationDirectory
I heartily recommend the ANT tool for compiling servlets. It solves many annoying problems with classpaths by allowing you to define them in a build.xml file. Yes, ANT presents a bit of a learning curve, but you will be glad you did. Personally I edit/manage servlet projects with UltraEdit-32 and have ANT configured as a tool that can be run from the editor. Bill
Completely disagree. A more-than-trivial number of the questions in this forum, the JSP forum, and the Java in general forums are related to problems doing simple builds. Learning Ant is one of the best steps one can take when setting out to do anything non-trivial with Java -- including servlets. bear [ September 26, 2003: Message edited by: Bear Bibeault ]
sorry friend..dont misguide urself.. Download the latest jsdk version from the sun site.. for eg:jsdk2.0 before compiling a servlet program at the command line. set the classpath as follows i have assumed jsdk2.0 folder in the e: drive) >set classpath=e:\jdsk2.0\lib\servlet.jar; Now u can compile the servlet as a normal javac command. But remember that the class file has to be stored in the classes folder.
Author and all-around good cowpoke
Joined: Mar 22, 2000
The initial post said that the guy was new to servlets and then William recommends learning Ant? Servlets present enough of a challenge to a newbie. Bad advice my friend.