7

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

Chinmaya B
  • 405
  • 1
  • 7
  • 21

1 Answers1

24

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".

Update

Initially, there are only few Server Runtime Environments available with Eclipse like:

  1. Apache
  2. Basic
  3. ObjectWeb

On an additional note, you can add more Server Adapters using the link Download additional server adapters in Server Runtime Environments dialog screen.

Server Runtime ENvironment List in Eclipse Preferences

Two

In Project Properties (Right Click on Project -> Properties), in Java Build Path, add Library "Server Runtime".
On adding Server Runtime to Project Library will add servlet-api.jar and jsp-api.jar jars to project dependencies.

Add Server Runtime Library to Project

Mandar Pandit
  • 2,171
  • 5
  • 36
  • 58
  • that was exactly what i need thanx you were like a saviour – Chinmaya B Jun 27 '14 at 16:39
  • by the way if this was automated it would be easier...why is eclipse so much descriptive while using?? – Chinmaya B Jun 27 '14 at 16:41
  • I have given the answer considering Eclipse IDE, there might be different options available with other IDE's, which I am not aware much. So I mentioned that this answer is considering the Eclipse IDE. And one more point, the screenshot attached with the question is looks like to be a screenshot of Eclipse IDE. – Mandar Pandit Jun 27 '14 at 16:43