beautypg.com

Outline, Initializing the java vm – FUJITSU J Adapter Class Generator User Manual

Page 22

background image

22 Chapter 3. Developing Programs

...
REPOSITORY.
CLASS J-OBJECT AS "java-lang-Object"
...
LINKAGE SECTION.
01 P1-OUTPUTSTREAM OBJECT REFERENCE J-OBJECT.
...

Developing an Application That Uses an Adapter Class

This section explains how to develop a program that uses an adapter class.

Outline

The flow of program processing using the adapter class is as follows:
1. Initialization of the Java VM.
2. In the case of a multithreaded application, connection of the current thread to

the Java VM .

3. Generation of the object.
4. Calling the method.
5. In the case of a multithreaded application, disconnection from the Java VM .
6. Termination of the Java VM.
Also, be careful when performing the following operations:
• Manipulating a variable
• Comparing object references
• Assignment to a subclass
• Mapping java.lang.String into PIC X.
• End control of character string
• Exception processing

Initializing the Java VM

To use an adapter class, the Java virtual machine (VM) must first be initialized . Use

the JVM-INIT method or the JVM-ATTACH method of the FJ-JAVA-CONTROL class to

initialize the Java VM.
A coding sample is shown below:

...
REPOSITORY.
CLASS FJ-JAVA-CONTROL
...
PROCEDURE DIVISION.
...
INVOKE FJ-JAVA-CONTROL "JVM-INIT".
...