This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes Help me out very simple basic problem in servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Help me out very simple basic problem in servlets" Watch "Help me out very simple basic problem in servlets" New topic
Author

Help me out very simple basic problem in servlets

Matt Swaggi
Ranch Hand

Joined: May 29, 2008
Posts: 61
Hay i am having eclipse platform version 3.3.0
i am beginner in java, just started servlets
But the problem is i cant import javax.servlets.*;
i cant find javax.servlets on my eclipse , do i have to install more
for servlets, please help me out !
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14278
    
  21

The servlet API is not part of Java SE. You need to add a JAR file to the classpath. See Compiling Servlets in the JavaRanch FAQ.

In Eclipse, you add a JAR to your project by right-clicking on the project, selecting Properties, then go to Java Build Path, Libraries. Click Add External JARs; lookup the JAR with the servlet API and add it.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Hi,

Just in case you are wondering what jar file to include, Download JSWDK(Java Sever Web Development Kit) from Sun's website and you will find servlet.jar in it.

Thanks.


Be Humble... Be Nice.
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Copy servlet-api.jar or servlet.jar and paste it to the $TOMCAT/lib/ folder and then try to compile the servlet file..
[ July 10, 2008: Message edited by: Rajkumar balakrishnan ]

Never try to be a hard-worker. Be a smart-worker.
My Blog
Matt Swaggi
Ranch Hand

Joined: May 29, 2008
Posts: 61
Thank You . Its Working !
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Help me out very simple basic problem in servlets