CreateJavaObject

Mon 01 January 2018

Syntax

CreateJavaObject(ClassName [ConstructorParams])

Where ConstructorParams has the form

argument1 [, argument2] . . . 

Description

Use the CreateJavaObject function to create a Java object that can be manipulated in PeopleCode.

Note: If you create a class that you want to call using GetJavaClass, it can be located in a directory specified in the PS_CLASSPATH environment variable or in other specified locations. The PeopleCode API Reference provides details on where you can place custom and third-party Java classes.

See .

Use the CreateJavaObject function to create a Java array when you know how many values it should contain. If ClassName is the name of an array class (ending with [ ]), ConstructorParams are used to initialize the array.

In Java, do the following to initialize an array:

intArray = new int[]{1, 2, 3, 5, 8, 13};

Do the following to initialize such a Java array from PeopleCode:

&IntArray = CreateJavaObject("int[]", 1, 2, 3, 5, 8, 13);

To initialize a Java array without knowing the number of parameters until runtime, use the CreateJavaArray function.

Parameters

Field or Control

Definition

ClassName

Specify the name of an already existing class.

ConstructorParams

Specify any construction parameters required for the class. Constructors are matched by construction parameter type and placement.

Returns

A Java object.