Mar 14, 2008

javax.servlet cannot be resolved when using Java 6

Error Message

The import javax.servlet cannot be resolved when using Java 6

Description

Java 5 uses the j2ee.jar library for javax.servelet where Java 6 uses the javaee.jar library

Solution

Add javaee.jar to the project class path. Note: Use the jdk or skd and not the jre.
In Eclipse > Project Properties > Java Build Path > Add External JARs > javaee.jar which can be found in the %JAVA_HOME%\sdk\lib