The IBM® Developer Kit for Java™ supports these Invocation API functions.
Returns information about all Java virtual machines that were created. Even though this API is designed to return information for multiple Java virtual machines (JVMs), only one JVM can exist for a process. Therefore, this API will return a maximum of one JVM.
Signature:
jint JNI_GetCreatedJavaVMs(JavaVM **vmBuf, jsize bufLen, jsize *nVMs);
vmBuf is an output area whose size is determined by bufLen, which is the number of pointers. Each Java virtual machine has an associated JavaVM structure that is defined in java.h. This API stores a pointer to the JavaVM structure that is associated with each created Java virtual machine into vmBuf, unless vmBuf is 0. Pointers to JavaVM structures are stored in the order of the corresponding Java virtual machines that are created. nVMs returns the number of virtual machines that are currently created. Your iSeries™ server supports the creation of more than one Java virtual machine, so you may expect a value higher than one. This information, along with the size of the vmBuf, determines whether pointers to JavaVM structures for each created Java virtual machine are returned.
Allows you to create a Java virtual machine and subsequently use it in an application.
Signature:
jint JNI_CreateJavaVM(JavaVM **p_vm, void **p_env, void *vm_args);
p_vm is the address of a JavaVM pointer for the newly created Java virtual machine. Several other JNI Invocation APIs use p_vm to identify the Java virtual machine. p_env is the address of a JNI Environment pointer for the newly created Java virtual machine. It points to a table of JNI functions that start those functions. vm_args is a structure that contains Java virtual machine initialization parameters.
If you start a Run Java (RUNJVA) command or JAVA command and specify a property that has an equivalent command parameter, then the command parameter takes precedence. The property is ignored. For example, the os400.optimization parameter is ignored in this command:
JAVA CLASS(Hello) PROP((os400.optimization 0))
For a list of 0S/400 unique properties that are supported by the JNI_CreateJavaVM API, see Java system properties.
Destroys the Java virtual machine.
Signature:
jint DestroyJavaVM(JavaVM *vm)
When the Java virtual machine is created, vm is the JavaVM pointer that is returned.
Attaches a thread to a Java virtual machine, so it can use Java virtual machine services.
Signature:
jint AttachCurrentThread(JavaVM *vm, void **p_env, void *thr_args);
The JavaVM pointer, vm, identifies the Java virtual machine to which the thread is being attached. p_env is the pointer to the location where the JNI Interface pointer of the current thread is placed. thr_args contains VM specific thread attachment arguments.
Signature:
jint DetachCurrentThread(JavaVM *vm);
vm identifies the Java virtual machine from which the thread is being detached.
For a complete description of the Invocation API functions, refer to the Java Native Interface Specification by Sun Microsystems, Inc., or The Source for Java Technology java.sun.com.