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 JSP and the fly likes Classpath issue for JSP 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 » JSP
Bookmark "Classpath issue for JSP" Watch "Classpath issue for JSP" New topic
Author

Classpath issue for JSP

tarun mall
Greenhorn

Joined: Nov 23, 2011
Posts: 13
Hi friends,

Our application structure is like, we have 5 web projects and a project for Jars. All the jars which are required to any project, we keep those jars in Jars-Project and then add them in classpath.
Now the problem is I have to integrate a third party utility in my application. They provided few jars required by there project and a folder containing files, css, scripts and images for JSP. When I put all the jars in WEB-INF/lib and call the JSP it is working fine. But when I put all the jars in Jars-Project and include them in class path, its finding none of them. The problem with putting in lib is, there are many jars which are already in our Jar-Project. I dont want to keep them at two places and cause redundancy.

I think I didn't understand the concept of WEB-INF/lib completely. What I think is whenever we put all jars in WEB-INF/lib eclipse adds them to the buildpath of the project. So in case if we add them directly to build-path it should work.
tarun mall
Greenhorn

Joined: Nov 23, 2011
Posts: 13
Here are my findings by googling.

Whenever we create WAR it includes all the classes in the project in WEB-INF/classes and hence JSP is able to find it. But it doesn't copy the classes in jars to WEB-INF/classes and hence my JSP is not able to find the classes inside JAR. So somehow I need to add somewhere a configuration that copies classes in JAR(from classpath) to WEB-INF/classes or includes JAR directly to WEB-INF/lib.
tarun mall
Greenhorn

Joined: Nov 23, 2011
Posts: 13
This link helped: http://stackoverflow.com/questions/5467038/adding-3rd-party-jars-to-web-inf-lib-automatically-using-eclipse-tomcat

Problem solved. Thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Classpath issue for JSP