• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Package javax.servlet  RSS feed

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 9087
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The servlet stuff is not in the jdk. You need to download the j2ee.jar (j2eesdk
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sen George
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By adding the jar entry in the Classpath variable worked.

Thank you.

Sen.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!