JNI compatibility

If you are working with the Java™ Native Interface (JNI), you must ensure that your system is set up appropriately.

When you build a C or C++ program that uses the invocation API, your directory path variable must include the directories that contain the JVM shared libraries, lib and lib/j9vm, as well as the directories that contain the application's shared libraries. On AIX® and z/OS® systems, the path variable is LIBPATH, on Linux® it is LD_LIBRARY_PATH, and on Windows it is PATH.

For information on JNI runtime linking, see JNI runtime linking.

Additional information for AIX systems

If you are writing a C or C++ program that uses the JNI Invocation API (that is, the program creates a Java virtual machine and calls Java code), you might want to ensure that the following variables are set appropriately. By default, all the Java launchers that are shipped with the SDK (for example, java, jar) set up these environment variables to the values that are specified as follows:
You must build:
  • 32-bit and 64-bit executables and shared objects. To do this, use the -qarch=ppc option.
  • JNI executables and shared objects. For the 32-bit SDK, these should be built as 32-bit executables or shared objects. For the 64-bit SDK, they should be built as 64-bit programs or shared objects, using the -q64 option.