File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes New to Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "New to Servlets" Watch "New to Servlets" New topic

New to Servlets

Nandini Sriram
Ranch Hand

Joined: Jul 04, 2003
Posts: 132
I am very new to Servlets. I went through some basics. I have some doubts in running servlets. I read that it needs Tomcat to run the servlets. I also saw the J2SDKEE 1.3.1 download on the Sun's site. Which one should I install to run Servlets/ JSPs?
Please guide me.

Discipline, Dedication and Determination define Destiny.
Amit KumarS
Ranch Hand

Joined: Oct 10, 2003
Posts: 100
Hi ...
for running a servlet you first need to compile your servlet's .java file and for that you need J2SDKEE 1.3.1 'cause this J2SDKEE 1.3.1 has the jars like servlet.jar which helps in compiling your .java files and making .class files.. you need to install the J2SDKEE 1.3.1 and putt it into the class path..
now, once you are ready with the .class file of your servlet you need a web server like Tomcat, resin, weblogic etc... you can choose one among these and install into your machine...
now you need to put this class file into the class hierarchy..
let me give you an example... if you are using tomcat then you will have to make an application in your tomcat (if you already have one then ignore this)
1. You need to make a directory(suppose hello) in webapps folder by any name you want
2. make sorrocponding entry into server.xml which is in conf directory like below

3. now u need to create following directory structure in your "hello" directory
|-(All JSP and HTML files here on in any subfolder you need)
|-classes (all your servlet class files here)
|-web.xml (here all enteries of your servlet will go)
4. now you can run your tomcat and in browser you can type

hope things are clear to you now.. if still in doubt please revert back

****************************<br />In 24 hrs Earth rotates once on its Axis.
Malhar Barai
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
Hi Nandini..
Other way you can download jwsdpJWSDP(Java Web Services Developer Pack)
With the bundle you can get Tomcat & Ant Tool too. Also download its DOCS.
Tomcat is a servlet container as explained by Amit.
Ant tool can be used to compile your servlet, build your servlet context.
You can have more info on ANT here

Malhar Barai
SOA & Java Book
Nandini Sriram
Ranch Hand

Joined: Jul 04, 2003
Posts: 132
Thanks a lot Amit and Malhar.
I have installed the J2EE1.3 and Tomcat4.1. I am able to start the Tomcat server.
I have created a file. But it is not getting compiled. Should this .java file be in any specific directory?

I get "cannot resolve symbol" errors. I have set my classpath to "servlet.jar" inside Tomcat 4.1\common\lib.
Thanks in advance.
[ November 01, 2003: Message edited by: Nandini Sriram ]
Nandini Sriram
Ranch Hand

Joined: Jul 04, 2003
Posts: 132
Ok, I was able to run my first servlet.
I agree. Here's the link:
subject: New to Servlets
Similar Threads
How to configure?
web.xmi in servlets
Servlet not running
Servlet Materials
New to Servlets; Want to download JSDK; Where to find?