Eclipse reports "The import javax.servlet cannot be resolved"...

Hi -

My Eclipse IDE has been setup to use JRE 1.5.0_03. The IDE reports that it is unable to locate the following classes:


I checked rt.jar for the above version of JRE and don't find a javax.servlet package. Have these classes moved to another location?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You need to download and add an extra .jar file.

Download servlet.jar from Apache.

If you have TOMCAT installed on your computer, look at:

C:\Program Files\Apache Group\jakarta-tomcat-3.2.3\lib\servlet.jar

The TOMCAT version may be different.

Then add that .jar to your ECLIPSE project.

Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
You need to add servlet.jar or if you are using Tomcat 5.x add the all the jars starting with servlet to the build path.

Follow these steps

right click on the project and select properties

and then select java Build Path in that select libraries tab and click add external jars button and point to the above mentiond jars.

Your problem will be resolved.

Thank You.
Mayank SAssociate Director - Product EngineeringCommented:
Download Tomcat from:
baigmzAuthor Commented:
I am using WebLogic Server as my application server. Doesn't it support web application development for HTTP servlets?
Mayank SAssociate Director - Product EngineeringCommented:
It should - are you using a Weblogic plug-in for Eclipse? Make sure you have added the JARs into your project's build-path. They should be present in some lib directory under Weblogic's root folder.
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
ya ya it support web application development for HTTP servlets, will just add weblogic.jar or add all the jars in the bea\weblogic81\server\lib in the build path.

Thank You.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.