Using the Java/COBOL Application Launcher from the Command Line

The command to invoke the Java/COBOL application launcher can take one of two formats:

cobjrun [options] class [arguments]
cobjrun -jar [options] jarfile [arguments]

where the parameters are:

options
The options you would normally specify to your Java application launcher.
class
The name of the class to be invoked. If the Java/COBOL application launcher cannot find a Java class of this name, it tries to find a COBOL program of the same name. If a COBOL program is found, it is executed.
arguments
The arguments to pass to the main function.
-jar
Specifies that a program from a JAR file is to be executed.
jarfile
The name of the Java archive (.jar) file to be invoked.
Important:
  • The Java/COBOL application launcher loads a specified class, and invokes the class's main method, where the method declaration must be in one of the following formats.
    If the class is a Java class:
    public static void main(String args[])
    If the class is a COBOL class:
    method-id main static.
    
    procedure division using by value args as string occurs any.
  • If the Java application is contained in a .jar file, you need to add it to the classpath by using the -classpath (or -cp) option and specifying the fully qualified class-name
  • If you specify a .jar file that contains a manifest including a Main-Class attribute, you can use the -jar option to execute the application
  • When using cobjrun in a 64-bit AIX environment, you must specify the locations of shared libraries using the LIBPATH environment variable, for example
    export LIBPATH=/usr/java6_64/jre/lib/ppc64/j9vm:/usr/java6_64/jre/lib/ppc64:/usr/java6_64/jre/../lib/ppc64:
  • If you receive an Could not load JVM... error, check your environment settings, and also ensure your effective working mode (COBMODE) matches the version of Java shared libraries being called.
  • If the effective working mode is not set, you can directly invoke the correct environment by using either cobjrun32 or cobjrun64.