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!
It contains, among others, the files /usr/share/java/servlet-api-2.5. jar and /usr/share/java/jsp-api-2.1. jar , which are the servlet and JSP libraries you need.
A servlet is a Java programming language class that is used to extend the capabilities of servers that host applications accessed by means of a request-response programming model. Although servlets can respond to any type of request, they are commonly used to extend the applications hosted by web servers.
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:
On an additional note, you can add more Server Adapters using the link Download additional server adapters
in Server Runtime Environments dialog screen.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With