Link to home
Start Free TrialLog in
Avatar of baigmz
baigmz

asked on

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:

javax.servlet.http.Cookie;
javax.servlet.http.HttpServletRequest;
javax.servlet.ServletException;

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?
Avatar of sciuriware
sciuriware

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

;JOOP!
Download servlet.jar from Apache.

;JOOP!
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.

;JOOP!
Avatar of Siva Prasanna Kumar
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.
Download Tomcat from: http://tomcat.apache.org/
Avatar of baigmz

ASKER

I am using WebLogic Server as my application server. Doesn't it support web application development for HTTP servlets?
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.
ASKER CERTIFIED SOLUTION
Avatar of Siva Prasanna Kumar
Siva Prasanna Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial