File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes package javax.servlet.* not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "package javax.servlet.* not found" Watch "package javax.servlet.* not found" New topic

package javax.servlet.* not found

Anand Shrivastava
Ranch Hand

Joined: Jul 22, 2007
Posts: 125
Dear friends,

I have installed java 7 on my machine. However, when i try to compile any servlet it is not able to locate any of the packages relating to servlets i.e. javax.servlet.* and javax.servlet.http.*.

I surfed the net and found that I need to have jsdk.jar. However, despite rummaging the net for an entire week, I could not find jsdk.jar. I was also directed to a page which says that I should download the servlet development kit, but the links provided in most of the pages on the net are old and redirect me to the oracle sun site, which does not have any such development kit. Now, it has become a nightmare for me to compile even a trifle servlet.

Kindly help,
Thanks in anticipation.


Anand Shrivastava
Joemon Anthony

Joined: May 22, 2011
Posts: 26

Add servletconfig.jar in your class-path.

(SCJP 5, OCA 9i)
(Always interested in learning)
kumar prabhakar

Joined: Feb 27, 2012
Posts: 13

Servlet API is not included in JDK ,I did it by installing tomcat and by then added path C:\Program Files\Java\Tomcat 7.0\lib\servlet-api.jar to the classpath environment variable.
Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 171

As you said, servlet-api.jar needs to be added in the class path. Just try out these options.
1) If you are running from cmd prompt, close and open a new window to compile. Since it may be resulting to the old one.
2) print and check the class path in cmd prompt
3) Try to remove spaces in the class path.

No pain, No gain.
OCJP 1.6, Liferay Certified Developer 6.1
Tim Moores

Joined: Sep 21, 2011
Posts: 2415
jsdk.jar, and the servlet development kit, have ceased to exist years ago. What you read must have been obsolete for a loooong time.

Add servletconfig.jar in your class-path.

No such thing exists.

As kumar said, the easiest is to download a servlet container (like Tomcat); it has everything you need.
I agree. Here's the link:
subject: package javax.servlet.* not found
It's not a secret anymore!