Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

package javax.servlet.* not found

 
Anand Shrivastava
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Joemon Anthony
Greenhorn
Posts: 26
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add servletconfig.jar in your class-path.
 
kumar prabhakar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 171
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Moores
Bartender
Posts: 2951
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic