File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes unable to locate javax.servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "unable to locate javax.servlet" Watch "unable to locate javax.servlet" New topic
Author

unable to locate javax.servlet

Monty Caywood
Greenhorn

Joined: Mar 31, 2011
Posts: 2

I am trying to make a simple servlet. I've imported javax.servlet.* and compiler is complaining that it can't be found. I've researched this problem and everything points to my CLASSPATH. I’ve downloaded the j2ee.jar, I have pointed my CLASSPATH to C:\Sun\AppServer\lib (where the j2ee.jar file is) along with pointing it to C:\Tomcat 5.5\common\lib where the servlet-api.jar is located and I still get the same error message (and I have rebooted the system). Can anyone help please?!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

The only way that this will happen is if servlet-api.jar is not in the classpath. You say that you have added it correctly, but if it were, you would not be getting the message.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3742
    
  16
You say you have pointed the classpath at the directories where the jar files are. That is not enough - you have to include the full path including the name of the jar file.


Joanne
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
. . . and welcome to the Ranch
Monty Caywood
Greenhorn

Joined: Mar 31, 2011
Posts: 2
Thank you all for the post! Actually Mr. Bibeault, my classpath was correct. I even added the .jar file directly in the classpath as Joanne suggested and it still wouldn't reconize the import statement. I had to go into NetBeans, go the Project tab, right clicking on the Libraries and adding the Jar file that way.
Again all thank you very much for your input!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to locate javax.servlet