prograMNewbie
asked on
Build path error
Hello everyone,
When I try and do the following import:
import javax.servlet.ServletExcep tion;
I got this error:
The project was not built since its build path is incomplete. Cannot find the class file for javax.servlet.ServletExcep tion. 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
When I try and do the following import:
import javax.servlet.ServletExcep
I got this error:
The project was not built since its build path is incomplete. Cannot find the class file for javax.servlet.ServletExcep
Servlet.jar is on my build path, anyone know whats going on. Ive been trying to fix this all day!
Thanks
>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
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
Make sure that you add the Servlet.jar to your classpath.
ASKER
>>Are you sure?
Yes because I have tomcat on my build path which is and servlet.jar is on the build path of tomcat.
Yes because I have tomcat on my build path which is and servlet.jar is on the build path of tomcat.
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?
And we are talking classpath right?
And have you read rrz@'s comment?
ASKER
>>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!
Thanks for the acknowledgment, Tim.
ASKER
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
>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/servl et-api.jar or if you Tomcat 5 or 4 then add <yourTomcatHome>/common/li b/servlet- api.jar or if you are using an older version add <yourTomcatHome>/common/li b/servlet. jar
I don't use eclipse so I can't tell how exactly.
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/servl
I don't use eclipse so I can't tell how exactly.
> 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?
what exactly do you mean by this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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)
(Click on add external jars for the same)
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.
mayank, I was referring to 'your' comment itself - just added the info about the 'Librarires' tab - in case the author tries adding it elsewhere :)
Sorry.
Are you sure?