Interfacing with Java

This chapter gives a brief description of Java™ and the Java Native Interface (JNI) and explains why you might be interested in using it with PL/I.

This chapter describes a simple Java-PL/I application and provides information about compatibility between the two languages. Instructions on how to build and run the Java-PL/I sample applications assume that the work is being done in the z/OS® UNIX System Services environment of z/OS.

Before you can communicate with Java from PL/I, you need to have Java installed on your z/OS system. Contact your local System Administrator for more information about how to set up your z/OS Java environment. For more information, refer to the IBM® Java’s support website at https://www.ibm.com/support/pages/java-sdk-products-zos.

These sample programs have been compiled and tested with IBM SDK for z/OS, Java Technology Edition Version 8.0, and IBM Semeru Runtime Certified Edition for z/OS Version 11.0. To determine the level of Java in your z/OS UNIX System Services environment, enter this command from the command line:

java -version

The active Java version is then displayed, as in the following example:

java version "11.0.15" 2022-04-19
IBM Semeru Runtime Certified Edition for z/OS 11.0.15.0 (build 11.0.15+10)
IBM J9 VM 11.0.15.0 (build z/OS-Release-11.0.15.0-b01, JRE 11 z/OS s390x-64-Bit

IBM Java Version 8.0 is available in 31-bit and 64-bit. IBM Semeru is 64-bit only. Ensure the proper libraries are accessible in your environment.

For communication with 64-bit Java, the simplest and most straightforward method is to use 64-bit PL/I.

For communication between 64-bit Java and 31-bit PL/I, we recommend having the 64-bit Java program call a 64-bit PL/I interface routine, which can call the 31-bit PL/I routine. For PL/I 31-bit and 64-bit interoperability, the Enterprise PL/I for z/OS 6.1 compiler is required. For more details about this feature, see Mixing AMODE 31 and AMODE 64 code.