vipin cp vipin cp - 6 months ago 18
Java Question

class not found add jar via eclipse

When I was working with java spring hibernate struts2 eclipse project. I used buildpath-> addjar option to add jars from a folder inside the workspace. Even if the class is available it shows class not found exception.

If i put those jar files in web-inf/lib folder everything works.. Should i keep those files in the lib itself? Can i just include those jars in a seperate folder and add jar using eclipse configure build path??

what is the problem ? please help me... thanks in advance...

Answer

If you're using a standard Eclipse Dynamic web project, best way to go is to put all your Jars in the WEB-INF\lib folder. This will automatically add them to your build path and also include them in your WAR when you export it.

If you still want to use the Build Path > Add Jar option on the project, and want your Jars to also be included in your WAR, you have to go to the Project Properties > Deployment Assembly configuration and include them there. Of course this is double the work for every Jar.

Comments