JavaLoadObject Function

Action

Instantiates a Java object and returns a handle on it. The Java object must be released by the JavaFreeObject command.

Include file

Java.bdh

Syntax

JavaLoadObject( in sClassSpecifier : string,
                in sTimerName      : string optional ): number;

Return value

  • Handle on the Java object.

Parameter Description
sClassSpecifier

Fully qualified name of the class to instantiate. The class must be available via the classpath. The ‘/’ character has to be used as package separator.

Example: java/lang/String.

sTimerName

(optional)

Creates a custom time measure with the specified name for this function.

Example

var
  hTestObj   : number;

dcltrans
  transaction TInit
  begin
      // Load and start the JVM.
      JavaCreateJavaVM();

      // instantiate the java class
      hTestObj := JavaLoadObject("Test");
  end TInit;

  transaction THello
  begin
    JavaCallMethod(hTestObj, "doHello");
  end THello;

  transaction TEnd
  begin
    JavaFreeObject(hTestObj);
  end TEnd;

Sample scripts

JavaFrameworkBankSample.bdf

BankSample.java, Account.java, Customer.java, PremiumCustomer.java