Table of Contents

Java command line options

When you start a Java application that uses JCOBridge, the following options are parsed automatically from the command line.

java [all java/JVM options here] -cp "[path to JCOBridge.jar];[classPath]" yourJavaClass [--NativePath:] [--LicensePath:] [--CoreCLRRID:] [--CoreCLRVersion:] [--CoreCLREnableDesktop]
Option Description
--NativePath:"PATH" Path of the JCOBridge runtime. Default is the folder of JCOBridge.jar.
--LicensePath:"PATH" Path of the JCOBridge license file, or the URL of the license.
--CoreCLRRID:value Runtime identifier (RID) to use. It is found automatically from system information: set it to override the detected value.
--CoreCLRVersion:"Version" Major version of .NET to use: 10 or 11.
--CoreCLREnableDesktop Enables .NET desktop applications (WPF and Windows Forms).

Environment variables

Every option above can also be set with an environment variable, parsed by the engine in the same way. Prepend JCOBRIDGE_ to the name of the option: for example LicensePath becomes JCOBRIDGE_LicensePath.

Usage example

Start your Java class on .NET 10 and enable desktop applications:

java -cp "../../CLR/Output/JCOBridge.jar;./Output" yourJavaClass --CoreCLRVersion:10 --CoreCLREnableDesktop

Code to use in your Java class:

import org.mases.jcobridge.*;

public class yourJavaClass {
    public static void main(String args[]) {
        try {
            try {
                JCOBridge.Initialize(args);
            } catch (JCException e) {
                e.printStackTrace();
            }
            // all stuff
        } catch (JCException jce) {
            jce.printStackTrace();
        }
    }
}