This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 14114
    
  16

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 7 API documentation
Scala Notes - My blog about Scala
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 !
 
Don't get me started about those stupid light bulbs.
 
subject: Help me out very simple basic problem in servlets