[Logo]
Forums Register Login
Package javax.servlet
I wrote a simple Java program to work with Tomcat to display a simple web page. I have included the following import statements:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

The following entries are there in the Classpath variable:
c:\Sen\Java\JavaT\jdk1.5\bin; c:\Sen\Java\JavaT\jdk1.5\lib; c:\Sen\Java\JavaT\jdk1.5\; c:\Sen\Java\JavaT\jdk1.5\jre\bin\

On compiling, I get the following error:
Ch1Servlet.java:1: package javax.servlet does not exist
import javax.servlet.*;
^
Ch1Servlet.java:2: package javax.servlet.http does not exist
import javax.servlet.http.*;

Please advise what needs to be done to resolve this.

Thanks in advance.

Sen.
The servlet stuff is not in the jdk. You need to download the j2ee.jar (j2eesdk
Alternative: As you are using Tomcat for deploying your servlet, hence to compile it you can include in your classpath: Your_TOMCAT_installation_directory\common\lib\servlet-api.jar
This should compile the servlet without any problem.
By adding the jar entry in the Classpath variable worked.

Thank you.

Sen.
Ever since I found this suit I've felt strange new needs. And a tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss


This thread has been viewed 864 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jul 18, 2018 10:18:03.