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
Anthony Watson
Ranch Hand
Joined: Sep 25, 2003
Posts: 327
posted
0
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
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
1
posted
0
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
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.
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.
Thnx
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
1
posted
0
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.
I calls 'em like I sees 'em
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
Also remember that Tomcat doesnot use the System CLASSPATH while running.