Solved

Build path error

Posted on 2007-03-21
15
1,255 Views
Last Modified: 2007-11-27
Hello everyone,

When I try and do the following import:
import javax.servlet.ServletException;

I got this error:
The project was not built since its build path is incomplete. Cannot find the class file for javax.servlet.ServletException. Fix the build path then try building this project            

Servlet.jar is on my build path, anyone know whats going on. Ive been trying to fix this all day!

Thanks
0
Comment
Question by:prograMNewbie
  • 3
  • 3
  • 3
  • +3
15 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 18764950
>> Servlet.jar is on my build path

Are you sure?
0
 
LVL 27

Expert Comment

by:rrz
ID: 18764983
>Servlet.jar is on my build path  
That is the wrong name.  Which version of Servlet API are you using ? Which container ?
Try using   servlet-api.jar   or  for older API  use servlet.jar
0
 
LVL 12

Expert Comment

by:keyurkarnik
ID: 18764993
Make sure that you add the Servlet.jar to your classpath.
0
 

Author Comment

by:prograMNewbie
ID: 18765065
>>Are you sure?

Yes because I have tomcat on my build path which is and servlet.jar is on the build path of tomcat.
0
 
LVL 35

Expert Comment

by:TimYates
ID: 18765100
Because something is on the build path of another project does not mean it will be in your buildpath

And we are talking classpath right?

And have you read rrz@'s comment?
0
 

Author Comment

by:prograMNewbie
ID: 18765102

>>Make sure that you add the Servlet.jar to your classpath.

It's on my classpath,

It might be worth noting that im using eclipse ide.

Cheers!
0
 
LVL 27

Expert Comment

by:rrz
ID: 18765146
Thanks for the acknowledgment, Tim.    
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:prograMNewbie
ID: 18765158

Sorry rrz@871311, never spotted your comment, I scrolled too far!.

Im sure the servlet.jar is the correct version because when i add servlet.jar (from tomcat) to my web app directly my class then compiles fine. This is of no use to me athough because I need to be able to reference servlet.jar from tomcat. But since tomcat is on the build path of my web app should'nt servlet.jar be picked up?

Many thanks
0
 
LVL 27

Expert Comment

by:rrz
ID: 18765352
>But since tomcat is on the build path of my web app should'nt servlet.jar be picked up?
I agree with Tim's comment. (I think he said no)  
You have to add the jar's path .  For example if you are using  Tomcat 6
then   add   <yourTomcatHome>/lib/servlet-api.jar  or if you Tomcat 5 or 4  then  add <yourTomcatHome>/common/lib/servlet-api.jar   or if you are using  an older version add <yourTomcatHome>/common/lib/servlet.jar  
I don't use eclipse so I can't tell how exactly.
0
 
LVL 92

Expert Comment

by:objects
ID: 18767343
> But since tomcat is on the build path of my web app should'nt servlet.jar be picked up?

what exactly do you mean by this?
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 250 total points
ID: 18767528
>> It might be worth noting that im using eclipse ide.

If you're building it via Eclipse then the system classpath doesn't matter - you need to add the JAR to your project's build path by right-clicking on your project -> Properties -> Java Build Path.
0
 
LVL 12

Expert Comment

by:keyurkarnik
ID: 18769627
As mentioned, add the servlet-api.jar to the 'Libraries tab'  under your project -> Properties -> Java Build Path
(Click on add external jars for the same)
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18776505
When did anybody mention Properties -> Java Build Path before I did? And I guess your comment mentioned Servlet.jar. The servlet-api.jar was mentioned by rrz.
0
 
LVL 12

Expert Comment

by:keyurkarnik
ID: 18777982
mayank, I was referring to 'your' comment itself - just added the info about the 'Librarires' tab - in case the author tries adding it elsewhere :)
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18784288
Sorry.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
split string containing \r\n in Java 46 38
print map entry 34 53
Windows 10 IE Certificate Issue 10 41
Way to decrease size of apk file 9 40
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now