Incorporating Java code from other applications

You can incorporate Java™ code from other existing applications into your ZIETrans projects in a variety of ways.

If you want to incorporate the source code (.java files) from your existing business logic so you can modify the code, you can import the .java files into the Source folder in your existing project. Click File > Import > General > File System to open the Import wizard. In the Import wizard, select the location of your source files in the From directory field. For Web projects, select the Java Source folder of your project in the destination Into folder entry field. When your source .java files are imported, they are automatically compiled and packaged into your ZIETrans project. You can edit, set breakpoints, and debug your source files in the Rational® SDP workbench.

You can also incorporate a Java archive (.jar) file with compiled Java business logic. The entire Java archive is added; you cannot select individual classes to add.
  1. Import the .jar file into the ZIETrans EAR project.
    1. Click File > Import > General > File System to open the Import wizard.
    2. Select the source directory of the Java archive (.jar) you want to import in the From directory field.
    3. Select the .jar file from the right pane.
    4. Select your ZIETrans EAR project as the destination in the Into folder field.
    5. Click Finish.
    6. When your .jar file is imported, click the Navigator tab of the ZIETrans Toolkit and expand your ZIETrans ear project. You will see the imported java archive file.
  2. Add a java archive to the project build path.
    1. In the Navigator tab of the ZIETrans Toolkit, select the project in which you want to invoke your business logic.
    2. Right-click the high-level ZIETrans project, and select Properties.
    3. In the Properties window, select Java Build Path in the left table and click the Libraries tab on the right.
    4. Click Add JARs to open the JAR Selection window.
    5. Expand the ZIETrans EAR project, and select the newly imported Java archive file.
    6. Click OK in the JAR Selection window, and click OK in the Properties window.
    7. Repeat this process for all ZIETrans projects for which you want to use the business logic.
  3. Define the project where the business logic is to be invoked.
    1. In the Navigator tab of the ZIETrans Toolkit, again select the project in which you want to invoke your business logic.
    2. Expand the project, the Web Content folder, and the META-INF folder.
    3. Double-click the MANIFEST.MF file to open the JAR dependencies editor. Select the check box next to each .jar file that you want to include in your project's class path.

There are other ways to import Java archives into the ZIETrans project. ZIETrans projects are extensions of Web projects in the Rational SDP workbench. For more information about importing files into Web projects, open the Rational SDP Help and search for Web projects