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 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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
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: 61448
    
  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: 3720
    
  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: 39478
    
  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!!!
 
Don't get me started about those stupid light bulbs.
 
subject: unable to locate javax.servlet