Advanced JNI Coding
The RPG IV compiler support for calling Java™ methods and for writing RPG native methods hides almost all the JNI coding from the RPG programmer. However, RPG's support is not necessarily the most efficient. For example, it always converts arrays between RPG and Java on calls and on entry and exit from native methods, but you may want to handle your own array conversions to improve performance.
The RPG support only gives you access to Java methods. If you want to access the fields in a class, you would have to add "get" and "set" methods to the Java class, or do JNI coding (see Accessing Fields in Java Classes).
Figure 1 is an example of a JNI call in RPG.
Note that the pointer JNIEnv_P is defined in the JNI /COPY file.