Chinmaya B Chinmaya B - 9 days ago 6
Java Question

javax.servlet.* cannot be resolved to a type

I am running ubuntu 14.04 and eclipse Kepler (with java ee modules preloaded) , I am developing Dynamic Web App for first time, it always says javax.servlet.xyz cannot be resolved to a type please help I am including a screen snapshot for my error page!

System Snapshot

Answer

Only two things are required in Eclipse for this:

One

In Eclipse, Window -> Preferences -> Server -> Runtime Environment
Specify your Web Server or Application Server path, by adding a "New Server Runtime Environment".

Server Runtime ENvironment List in Eclipse Preferences

Two

In Project Properties (Right Click on Project -> Properties), in Java Build Path, add Library "Server Runtime". Adding this will add servlet-api.jar to project dependecies.

Add Server Runtime Library to Project

Comments