Previous Topic Next topic Print topic


Using the Java/COBOL Application Launcher from the Eclipse IDE

Restriction: This topic only applies to local and remote development on Linux and UNIX platforms.
  1. In the JDK bin directory, create a symbolic link to the cobjrun executable in the bin directory in the product installation directory. To do this, execute the following from the command line:
    ln -s $COBDIR/bin/cobjrun /usr/java/<jdk version>/bin/cobjrun

    Create symbolic links in a similar way for each JDK that you plan to use.

  2. Configure your Java project to use the RuntimeSystem class which is in the mfcobol.jar in $COBDIR/lib. To do this:
    1. Launch Eclipse and open your Java project.
    2. Select the project and click Project > Properties.
    3. Select Java Build Path.
    4. Click the Libraries tab.
    5. Click Add External JARs and select the mfcobol.jar in $COBDIR/lib.

      Click OK.

  3. Before running the Java program, in Eclipse, you need to change the launch configuration so that it uses cobjrun which loads the COBOL libraries for Java. To do this:
    1. Launch Eclipse and open your Java project.
    2. Click Run > Run Configurations.
    3. Select the Java Application configuration in use.
    4. Click the JRE tab and then click Alternate JRE.
    5. Select the JRE that you want to use.
    6. In the java executable section, click Alternate and then type cobjrun.
    7. In the Java launch configuration, set the COBMODE environment variable as follows:
      1. Click the Environment tab for the configuration in use.
      2. Click New and add the environment variable COBMODE with value:
        32
        if you are calling 32-bit COBOL applications
        64
        if you are calling 64-bit COBOL applications

    This ensures the COBOL Server will be loaded before Java needs it.

  4. Additionally, when calling 64-bit COBOL applications, you need to add the 64-bit JDK libraries at the start of LD_LIBRARY_PATH as follows:
    1. Click the Environment tab for the configuration in use.
    2. Add the LD_LIBRARY_PATH variable with value:
      /usr/java/<jdk
      version>/jre/lib/amd64/server/:${env_var:LD_LIBRARY_PATH}
    3. Ensure Append environment to native environment is checked.
  5. Click Apply.
  6. Click OK.
Previous Topic Next topic Print topic