Adding Java code dependencies

When you write your Java code for a JavaCompute node, you can include references to other Java projects and JAR files.

Before you start

To complete this task, you must have completed the following tasks:

The Java code in a JavaCompute node might contain references to other Java projects in your Eclipse workspace (internal dependencies), or to external JAR files, for example the JavaMail API (external dependencies). If other JAR files are referenced, you must add the files to the project class path.

  1. Right-click the project folder of the project that you are working on and click Properties.
  2. Click Java Build Path on the left pane.
  3. Click the Libraries tab.
  4. Perform one of the following steps:
    • To add an internal dependency, click Add JARs..., select the JAR file that you want to add then click OK.
    • To add an external dependency, click Add External JARs..., select the JAR file that you want to add, then click Open. Copy the file to WorkPath/shared-classes where WorkPath is the full path to the working directory of the broker. If you do not copy the external dependencies here ClassNotFoundException exceptions are generated at run time.
    Tip:
    The default value for WorkPath is one of the following values:
    • For Windows systems, the default workpath is c:\Documents and Settings\All Users\Application Data\IBM\MQSI.
    • For UNIX systems, the default workpath is /var/mqsi.
    • For Linux systems, the default workpath is /var/mqsi.

    You have now added a code dependency.

Related tasks
Managing Java Files
Writing Java
Related reference
JavaCompute node