File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes servlet basics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "servlet basics" Watch "servlet basics" New topic

servlet basics

venkatesh badrinathan
Ranch Hand

Joined: Aug 03, 2008
Posts: 77
hi everybody, i am new to servlets. i have some basic servlet prog which i have tried to execute in my system. but it reported saying that servlets packages are not found. can someone please tell me which sdk should i install in my system to run my servlet programs.. please provide links if any.. thanks in advance;

Matteo Di Furia
Ranch Hand

Joined: Jun 20, 2008
Posts: 102
You don't need a SDK, you need a container to run your web application.
Have a look at Tomcat,
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
download the tomcat from the website and dowload the jdk
set the JAVA_HOME for jdk path
set the classpath for servlet-api.jar
see the headfirst servlet and jsp
ruban raj

Joined: Aug 05, 2008
Posts: 7
For executing servlet programs ,it needs server like jboss , tomcat or some other server.

Steps to Exceute Servlet programs:

1.Download jboss or tomcat server ,they are opensource products.

2.Set JAVA_HOME path

3.Set Server_Home path .For example if you use tomcat ,you have to set TOMCAT_HOME path.

4.Put servlet-api jar in lib folder.

5.start the server using startup.bat file.

6.Point out servlet url in address bar.
Martijn Verburg

Joined: Jun 24, 2003
Posts: 3274

Also do check out the ServletFaQ here at the Ranch!

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Douglas Carvalho

Joined: Oct 09, 2008
Posts: 4
There is no way I can compile the servlets. Before I set the pathes, that was a variable called Path. So, to compile my Java programs I did this way:

JAVA_HOME C:\Arquivos de programas\Java\jdk1.6.0_07\bin
Path "lots of things";%JAVA_HOME%\\bin

Then, I installed Tomcat but I can�t compile the servlets classes. I put the Tomcat on C:, so the path to servlet-api.jar is this:

C:\Tomcat6.0\lib\servlet-api.jar (I was surprised that there was no common directory like the FAQ said)

So, I don�t know what to do. I tried to put this path on the variable Path above, in the JAVA_HOME and I created a new variable too, but none has worked. What I did wrong? Thank you very much guys, and sorry for some grammar mistakes. I�m Brazilian and I�m learning English toghether with servlets (laughs).
Vijitha Kumara

Joined: Mar 24, 2008
Posts: 3829

I tried to put this path on the variable Path above, in the JAVA_HOME and I created a new variable too, but none has worked.

Set the path (to your servlet-api.jar) in the CLASSPATH environment variable(create a new one if you don't have one). Then you will be able to compile your servlets
[ October 09, 2008: Message edited by: Vijitha Kumara ]

[How to ask questions] [Twitter]
shar ball

Joined: Jul 14, 2005
Posts: 6
Douglas Carvalho,

If you still have issues trying to run your first servlet, you can follow the servlets demo here..

I agree. Here's the link:
subject: servlet basics