This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes package javax.servlet not found in import Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "package javax.servlet not found in import" Watch "package javax.servlet not found in import" New topic
Author

package javax.servlet not found in import

Tom Barns
Ranch Hand

Joined: Oct 27, 2000
Posts: 138
hi,
i need to set classpath to get that package,it was working,but changed my classpath setting and i do not know how to get it work.
any help will be appreciated.

Thanks for your help.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
The javax.servlet package classes are usually in servlet.jar
Since this is a "standard extension" package you should be able to put servlet.jar in the JAVA_HOME\jre\lib\ext directory and not have to set it in CLASSPATH at all.
Bill

------------------
author of:
Tom Barns
Ranch Hand

Joined: Oct 27, 2000
Posts: 138
Thanks for the reply.
how is that?the problem is when i compile my servlet program i got that message,I do that before even starting up my tomcat server.where exactly do i have to set to be able to compile my servlet.
thanks alot.
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
Hi Tom,
Check the following :

  • You have the current directory ".", in the classpath
  • As William has suggested, move/copy the servlet.jar file manually to the %JAVA_HOME%\jre\lib\ext folder.If you do this you donot need to set the classpath for javax.servlet.* packages, as the Java Run-time environment would find it for you.
  • Check my post at http://www.javaranch.com/ubb/Forum7/HTML/002990.html , to set the classpath on your machine, if you still require to do it(I hope not )

  • Hope this helps
    Regards,
    ------------------
    Sandeep Desai
    vgdesai@vsnl.com

    1. Sun Certified Java Programmer Scored 93 per cent
    2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
    3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
    4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56

    5. [This message has been edited by Desai Sandeep (edited April 10, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: package javax.servlet not found in import