Restriction: This topic applies to UNIX environments (remote development) only.
Restriction: This applies to native code only.
- 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.
- Configure your Java project to use the RuntimeSystem class which is in the mfcobol.jar in $COBDIR/lib. To do this:
- Launch Eclipse and open your Java project.
- Select the project and click
Project > Properties.
- Select
Java Build Path.
- Click the
Libraries tab.
- Click
Add External JARs and select the
mfcobol.jar in
$COBDIR/lib.
Click
OK.
- 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:
- Launch Eclipse and open your Java project.
- Click
Run > Run Configurations.
- Select the Java Application configuration in use.
- Click the
JRE tab and then click
Alternate JRE.
- Select the JRE that you want to use.
- In the
java executable section, click
Alternate and then type
cobjrun.
- In the Java launch configuration, set the COBMODE environment variable as follows:
- Click the
Environment tab for the configuration in use.
- 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
Enterprise Server will be loaded before Java needs it.
- 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:
- Click the
Environment tab for the configuration in use.
- Add the LD_LIBRARY_PATH variable with value:
/usr/java/<jdk
version>/jre/lib/amd64/server/:${env_var:LD_LIBRARY_PATH}
- Ensure
Append environment to native environment is checked.
- Click
Apply.
- Click
OK.