Incorporating Java code from other applications
You can incorporate Java™ code from other existing applications into your HATS 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 HATS project. You can edit, set breakpoints, and debug your source files in the Rational® SDP workbench.
- Import the .jar file into the HATS EAR project.
- Click File > Import > General > File System to open the Import wizard.
- Select the source directory of the Java archive (.jar) you want to import in the From directory field.
- Select the .jar file from the right pane.
- Select your HATS EAR project as the destination in the Into folder field.
- Click Finish.
- When your .jar file is imported, click the Navigator tab of the HATS Toolkit and expand your HATS ear project. You will see the imported java archive file.
- Add a java archive to the project build path.
- In the Navigator tab of the HATS Toolkit, select the project in which you want to invoke your business logic.
- Right-click the high-level HATS project, and select Properties.
- In the Properties window, select Java Build Path in the left table and click the Libraries tab on the right.
- Click Add JARs to open the JAR Selection window.
- Expand the HATS EAR project, and select the newly imported Java archive file.
- Click OK in the JAR Selection window, and click OK in the Properties window.
- Repeat this process for all HATS projects for which you want to use the business logic.
- Define the project where the business logic is to be invoked.
- In the Navigator tab of the HATS Toolkit, again select the project in which you want to invoke your business logic.
- Expand the project, the Web Content folder, and the META-INF folder.
- 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 HATS project. HATS 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