JavaSetOption Function

Action

Sets options for the Java Virtual Machine. This function has to be called prior to the JavaCreateJavaVM or JoltInit functions.

Include file

javabase.bdh

Syntax

JavaSetOption( in nOption : number,
               in sValue  : string ): boolean;

Return value

  • true if successful

  • false otherwise

   
nOption

Determines the option to be set. This parameter is one of the following flags:

JAVA_VERSION. Specifies the version number of the Java Virtual Machine. This option is obligatory. Valid option(s) are:

  • JAVA_V11

  • JAVA_V12

  • JAVA_V13

  • JAVA_V14

  • JAVA_V15

  • JAVA_V16

  • JAVA_V17

  • JAVA_V18

JAVA_HOME. Specifies the installation directory of the Java Virtual Machine. This option enables the Java Virtual Machine to be loaded for a different path than specified in the PATH environment, so that it is possible to switch between various Java Virtual Machines without changing the system PATH environment.

JAVA_CLASSPATH. Specifies the class path for the Java Virtual Machine. By default the class path is set to the system class path.

JAVA_DLL. Specifies a Dynamic Link Library (.dll) that implements the Java Virtual Machine to be used.

JAVA_VERBOSE. Sets the verbose option of the Java Virtual Machine. By default this option is disabled.

JAVA_DISABLE_COMPILER. Disables the Just In Time (JIT) compiler of the Java Virtual Machine. By default the Just In Time compiler is enabled.

JAVA_CMDLINE_OPTIONS. Specifies any command line options to be passed to the Java Virtual Machine.

JAVA_USE_SYSTEM_CLASSPATH. Determines that the system class path is used. This option is enabled by default.

JAVA_DESTROY_JVM_ON_SHUTDOWN. If it is not set (default), the current thread is detached from the JVM at shutdown, but the JVM is not destroyed. If it is set, all java threads are killed and JVM is destroyed on shutdown; to use this, JVMDI has to be enabled by setting -Xdebug -Xnoagent -Djava.compiler=NONE as commandline options. For getting profiling information with -Xrunhprof this flag has to be enabled.

JAVA_SUPPRESS_EXCEPTIONS. If it is not set (default), java exception will raise a bdl error. If it is set, java exceptions must be checked manually with JavaGetLastException command.

JAVA_ARCHITECTURE_VERSION. Specifies Java architecture version. Use the value JAVA_ARCH_32BIT for 32-bit Java (default) or JAVA_ARCH_64BIT for 64-bit Java.

sValue Value of the option to be set.

Example

dcltrans
  transaction TInit
  begin
    JavaSetOption(JAVA_VERSION, JAVA_V17);
    JavaSetOption(JAVA_HOME, "c:/Program Files/Java/jdk1.7.0");
    JavaSetOption(JAVA_CLASSPATH, "c:/myApplication/classes;c:/myTools/tools.zip");
    JavaSetOption(JAVA_DISABLE_COMPILER, YES);
    JavaSetOption(JAVA_CMDLINE_OPTIONS, "-ss8K -oss50K-DanyProperty=aValue");
    JavaSetOption(JAVA_ARCHITECTURE_VERSION, JAVA_ARCH_64BIT);
    JavaCreateJavaVM();
  end TInit;