Add a Jar Dependency

Version 7.1 by Gavin Eadie on 2009/02/17 22:37
Warning
For security reasons, the document is displayed in restricted mode as it is not the current version. There may be differences and errors due to this.

You'll often need to work with 3rd party Jars, as well as your own reusable code.

Adding these to your project is very simple.

  1. By default WOLips will create a Libraries folder in your project directory. Populate this with any jars you like.
  2. In Eclipse, right-click (or ctrl-click) on the jar and choose Build Path > Add to Build Path. This simply adjusts your project classpath but doesn't affect your final build.
  3. For frameworks, you should turn on the Export checkbox in the build path window as hown below in Fig. 1. Doing so ensures that other WebObjects projects the reference the framework "see" the jar library in their Eclipse build path.
Information
Fig. 1 Export jars when in a framework

!Picture 11.jpg!

  1. Adjust your build.xml file to ensure that the jar is also embedded in Contents/Resources/Java directory of the final build as below.

Either add an include entry for each jar...

Unknown macro: noformat. Click on this message for details.

... or have a single <include name="/.jar"/> to include all jars in the specified directory.