Malini Kennady Malini Kennady - 2 years ago 113
Java Question

How to avoid compilation error while referring common jar files?

I have a common jar that needs to be placed in Tomcat / Jetty lib folder, so that all the WAR files will be able to access the JAR. My code gets compilation error as it could not link to the JAR. How to access the common JAR that is placed in the lib folder of the server?

Answer Source

I have used Manifest file in WAR to link to the external JAR. In manifest file I specified the external JARs as, "Class-Path: ". To avoid compilation error, I linked the external JARs as "Java BuildPath -> Libraries". Though the JARs are linked using above method, only the JARs found in "lib" folder of the server is used by the application :-)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download