Compiling JVM COBOL

Important:

The IDE runs a Clean command before each build that deletes all .class files in the output folder of the JVM COBOL project.

JVM COBOL Classpath

Usually, programs in JVM COBOL projects use types that come from external artefacts like .class and .jar files. To successfully compile and build such projects, you must set a JVM COBOL classpath. You set this in the projects' properties on the Libraries tab in Micro Focus > Java Build Path.

Setting the JAVA Installation Directory

If you are developing a Java or JVM COBOL project, you do not have to set the Java installation directory using the JAVA_HOME variable. Follow these steps to identify the JRE using the Properties dialog box:

  1. Click Project > Properties.
  2. Click JVM Build Path and select the Libraries tab.
  3. Click JRE System Library and click the Edit button.
  4. Select Alternate JRE and then click Installed JREs to select the JRE you want to use.

Building JVM COBOL Projects Incrementally

By default, Eclipse automatically recompiles all sources in your project every time you save the project or when you change the project or file properties. This, however, could mean a considerable overhead when you have large projects. To avoid this, you can configure your project to only build the sources that have changed since the last time the project was built - this is known as incremental building.

In Visual COBOL, you can specify that a JVM COBOL project is built incrementally. How you specify this depends on the following:

  • JVM COBOL projects containing any mixture of procedural COBOL and class programs.

    To enable this feature, you need to specify the Use incremental build setting. This is equivalent to setting the ILINCREMENTALBUILD Compiler directive. When this directive is specified, Eclipse only recompiles programs that have changed and programs that refer to types or programs within those programs that have changed. Incremental builds will only take effect once you have a clean build environment with no errors. Having build errors will result in a failure to generate class files, a full build will continue until the errors are resolved.

    1. Right-click your project in COBOL Explorer and click Properties.
    2. Click Micro Focus > Build Configuration.
    3. Set Use incremental build to Yes.
      Note: This setting is under the JVM group.
    4. Click Apply and Close.

      Next time you make a change in the project, Eclipse only rebuilds the files that have changed.

    The build also creates a directory within the project output directory called JVMDependencies that stores dependency information for all the programs in your project. The JVMDependencies folder is not intended for distribution. If you want to package the contents of the output directory into a jar file, Micro Focus recommends that you turn off the incremental build feature and do a full clean rebuild.

    You can force a complete rebuild of the project manually by selecting Project > Clean.

    Note:

    Micro Focus recommends that you clean your project and build before packaging for distribution.

  • JVM COBOL projects that contain procedural code or extensions that take advantage of features of the managed frameworks including object-oriented (OO) syntax, and that compile as a JVM COBOL applications to Java byte code:

    You can enable the use of dynamic calls, which is equivalent to setting the ILDYNCALL Compiler directive that ensures that files in the project are compiled one at a time and that the build does not compile all files for one single compile command. It resolves calls to modules at run time rather than compile time; this has the effect of not requiring every module to be built.

    To enable dynamic calls:

    1. Right-click your project in COBOL Explorer and click Properties.
    2. Click Micro Focus > Build Configuration.
    3. Set Use dynamic calls to Yes.
      Note: This setting is under the JVM group.
    4. Click Apply and Close.

      Next time you make a change in the project, Eclipse only rebuilds the files that have changed.

    You can force a complete rebuild of the project manually by selecting Project > Clean.

    Tip: For maximum efficiency, Micro Focus recommends that you set Use dynamic calls to No, and clean your project before building and packaging it for distribution.