Converting an existing Java project to a plug-in project

If you have an existing Java project you can convert it to an OSGi plug-in project. The OSGi bundle can run in a pooled JVM environment and a JVM server.

About this task

This task assumes that you have an existing Java project in your workspace, and you want to convert it to an OSGi plug-in project.

Procedure

  1. In the Package Explorer view, right-click the Java project that you want to convert to a plug-in project, and click Configure > Convert to Plug-in Projects The Convert Existing Projects dialog is displayed.
    A screen capture of the Convert Existing Projects dialog showing four Java projects available for conversion, however only one is currently selected.
    The dialog contains a list of all the Java projects in your workspace. The one you chose to convert is selected. You can change your selection, or select more than one Java project to convert to a plug-in project.
  2. Click Finish. When you click Finish, the Java project, or projects, are converted to plug-in projects. The project name does not change, but the projects now include a manifest file and a build properties file.
  3. Requirement: You must now edit the plug-in manifest file and add the JCICS API dependencies. If you do not perform these steps, you will be able to export and install the bundle, but it will not run.
    Note: In CICS versions before CICS TS version 4.2 you had to add the Java class library, dfjcics.jar, to the Java build path. With CICS TS version 4.2, OSGi manages the build path for you. Before you perform the following steps you must edit the current build path and remove any references to dfhjcics.jar. If you do not remove all references to dfhjcics.jar, a NoSuchMethodException error occurs at run time.
    1. In the Package Explorer view, right-click the project name and click PDE Tools > Open Manifest. The manifest file opens in the manifest editor.
    2. Important: In CICS versions before CICS TS version 4.2, the Java class library, known as JCICS, is supplied in the dfjcics.jar JAR file. In CICS TS version 4.2 the library is supplied in the com.ibm.cics.server.jar file. If your project manifest contains the declaration: Import-Package: dfhjcics.jar; you must remove the declaration before continuing with the remaining steps.
    3. Select the Dependencies tab and in the Imported Packages section, click ADD. The Package Selection dialog opens.
    4. Select the package com.ibm.cics.server and click OK. The package is displayed in the Imported Packages list.
    5. Optional: Repeat the step above to install the following packages, if required for your application:
      Table 1.
      Package Description
      com.ibm.record The Java API for legacy programs that use IByteBuffer from the Java Record Framework that came with VisualAge. Previously in the dfjcics.jar file.
    6. Press Ctrl +S to save the manifest file.

Results

You have successfully converted your existing Java project to a plug-in project. However you must now update the manifest file to add a CICS-MainClass declaration. For more information see the related links.