You need to add the Servlet API to your classpath. In Tomcat 6.0, this is in a JAR called servlet-api.jar
in Tomcat’s lib
folder. You can either add a reference to that JAR to the project’s classpath, or put a copy of the JAR in your Eclipse project and add it to the classpath from there.
If you want to leave the JAR in Tomcat’s lib
folder:
- Right-click the project, click Properties.
- Choose Java Build Path.
- Click the Libraries tab
- Click Add External JARs…
- Browse to find
servlet-api.jar
and select it. - Click OK to update the build path.
Or, if you copy the JAR into your project:
- Right-click the project, click Properties.
- Choose Java Build Path.
- Click Add JARs…
- Find
servlet-api.jar
in your project and select it. - Click OK to update the build path.
Related Posts:
- Server Tomcat v9.0 Server at localhost failed to start
- Server Tomcat v9.0 Server at localhost failed to start
- An established connection was aborted by the software in your host machine tomcat jackson
- Unknown version of Tomcat was specified in Eclipse
- How to uninstall Eclipse?
- Eclipse/Maven error: “No compiler is provided in this environment”
- Is there a way to convert all comments into javadoc comments? [Eclipse/Java]
- “Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G
- Failed to write core dump. minidumps are not enabled by default on client version of windows
- How to uninstall Eclipse?
- Editor does not contain a main type in Eclipse [duplicate]
- getting error HTTP Status 405 – HTTP method GET is not supported by this URL but not used `get` ever?
- “Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G
- Editor does not contain a main type in Eclipse [duplicate]
- What is Java Servlet?
- JRE Missing when installing eclipse
- How to request.getParameterNames into List of strings?
- Cannot find “Package Explorer” view in Eclipse
- Why Maven project is tied to J2SE-1.5 by default?
- Session TimeOut in web.xml
- what does Dead Code mean under Eclipse IDE Problems Section
- what does Dead Code mean under Eclipse IDE Problems Section
- Eclipse: Java was started but returned error code=13
- java.net.SocketTimeoutException: Read timed out under Tomcat
- How to resolve Error listenerStart when deploying web-app in Tomcat 5.5?
- How to change a package name in Eclipse?
- what is this ANT build?
- Eclipse “Error: Could not find or load main class”
- Error: Selection does not contain a main type
- How to solve javax.net.ssl.SSLHandshakeException Error?
- Uri not Absolute exception getting while calling Restful Webservice
- Integrate Ant builder into Eclipse: Error “Variable references empty selection”
- Cannot change version of project facet Dynamic Web Module to 3.0?
- “Could not find Java SE Runtime Environment.” after installing Java
- Eclipse does not start when I run the exe?
- The declared package does not match the expected package “”
- eclipse won’t start – no java virtual machine was found
- Eclipse Java error: This selection cannot be launched and there are no recent launches
- How can I avoid this Ant Build error?
- java.lang.NumberFormatException: null i
- Access restriction: The type ‘Application’ is not API (restriction on required library rt.jar)
- org.apache.jasper.JasperException: Unable to compile class for JSP:
- Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory
- channel 3: open failed: connect failed: Connection refused
- Java can’t find file when running through Eclipse
- WebServlet cannot be resolved to a type
- keytool error bash: keytool: command not found
- No appenders could be found for logger(log4j)?
- Syntax error on token(s), misplaced construct(s)
- HTTP Status 500 Error instantiating servlet class
- hibernate properties not found
- “The public type <
> must be defined in its own file” error in Eclipse [duplicate] - Corrupt jar file
- Installing WindowBuilder on Eclipse Neon
- How to clear console in Java – Eclipse
- The import javafx cannot be resolved
- Fatal error compiling: tools.jar not found:
- Unreachable code in eclipse
- What is the difference between JSF, Servlet and JSP?
- How to resolve Unable to load authentication plugin ‘caching_sha2_password’ issue
- How to import a jar in Eclipse
- “The import org.springframework cannot be resolved.”
- Node cannot be resolved to a type
- Resource leak: ‘in’ is never closed
- Android Emulator: Unfortunately App has stopped
- Invalid initial heap size. Could not create the Java virtual machine
- Java console program
- implicit super constructor object() is undefined. must explicitly invoke another constructor
- “Source folder is not a Java project” error in eclipse
- Cannot be resolved to a variable error in Eclipse
- Using JavaFX in JRE 8, “Access restriction” error
- Eclipse Problems View not showing Errors anymore
- ‘No JUnit tests found’ in Eclipse
- “Cannot be resolved to a type” when attempting to use Scanner
- Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/JDBC_DBO]]
- Resolving File paths – ‘File not found’ error in Eclipse
- what is the difference between doGet() and doPost() in term of the flow?
- java eclipse red exclamation mark
- Eclipse is executing the wrong Java file
- build-impl.xml:1031: The module has not been deployed
- Eclipse: JVM terminated. Exit code=2
- “insufficient memory for the Java Runtime Environment ” message in eclipse
- Official reasons for “Software caused connection abort: socket write error”
- Which Eclipse IDE version to choose?
- Eclipse IDE – Error: Build path specifies execution environment Java SE 1.7
- Eclipse IDE – Error: Build path specifies execution environment Java SE 1.7
- getOutputStream() has already been called for this response
- A JRE or JDK must be available in order to run Eclipse. No JVM was found after searching the following locations
- Error :- java runtime environment JRE or java development kit must be available in order to run eclipse
- The import org.junit cannot be resolved
- Wrong project is being run in Eclipse
- Maven dependency update on commandline
- How to specify the default error page in web.xml?
- How to enable the Java keyword assert in Eclipse program-wise?
- Spring boot: Unable to start embedded Tomcat servlet container
- Http status 401 This request requires HTTP authentication (). in tomcat 6
- Why “no projects found to import”?
- Error message ‘Cannot be resolved or is not a field’
- How do I enable index downloads in Eclipse for Maven dependency search?
- Eclipse message saying List cannot be resolved to a type