@@ -2045,7 +2045,7 @@ JNI_CreateJavaVM_impl(JavaVM **pvm, void **penv, void *vm_args, BOOLEAN isJITSer
2045
2045
}
2046
2046
#endif
2047
2047
2048
- #if defined(AIXPPC )
2048
+ #if defined(AIXPPC ) || (defined( J9ZOS390 ) && ( JAVA_SPEC_VERSION >= 21 ))
2049
2049
/* CMVC 137180:
2050
2050
* in some cases the LIBPATH does not contain /usr/lib, when
2051
2051
* trying to load application native libraries that are linked against
@@ -2059,13 +2059,21 @@ JNI_CreateJavaVM_impl(JavaVM **pvm, void **penv, void *vm_args, BOOLEAN isJITSer
2059
2059
* Example libpath:
2060
2060
* LIBPATH=/jre/lib/ppc64/j9vm:/jre/lib/ppc64:/jre/lib/ppc64/jli:/jre/../lib/ppc64:/usr/lib
2061
2061
*/
2062
-
2062
+ #if defined(AIXPPC )
2063
+ const char * usrLib = "/usr/lib" ;
2064
+ const UDATA usrLibLength = LITERAL_STRLEN ("/usr/lib" );
2065
+ #else /* defined(AIXPPC) */
2066
+ /**
2067
+ * Currently Java 21 and up on z/OS build with system zlib: /lib/libzz64.so. If /lib isn't already present in LIBPATH, append it to the end,
2068
+ * so that system zlib can be resolved.
2069
+ */
2070
+ const char * usrLib = "/lib" ;
2071
+ const UDATA usrLibLength = LITERAL_STRLEN ("/lib" );
2072
+ #endif /* defined(AIXPPC) */
2063
2073
const char * currentLibPath = getenv ("LIBPATH" );
2064
2074
BOOLEAN appendToLibPath = TRUE;
2065
2075
if (NULL != currentLibPath ) {
2066
2076
const size_t currentLibPathLength = strlen (currentLibPath );
2067
- const char * usrLib = "/usr/lib" ;
2068
- const UDATA usrLibLength = LITERAL_STRLEN ("/usr/lib" );
2069
2077
const char * needle = strstr (currentLibPath , usrLib );
2070
2078
while (NULL != needle ) {
2071
2079
/* Note, inside the loop we're guaranteed to have
@@ -2085,7 +2093,7 @@ JNI_CreateJavaVM_impl(JavaVM **pvm, void **penv, void *vm_args, BOOLEAN isJITSer
2085
2093
}
2086
2094
}
2087
2095
if (appendToLibPath ) {
2088
- addToLibpath ("/usr/lib" , FALSE);
2096
+ addToLibpath (usrLib , FALSE);
2089
2097
}
2090
2098
}
2091
2099
/* CMVC 135358.
@@ -2095,7 +2103,7 @@ JNI_CreateJavaVM_impl(JavaVM **pvm, void **penv, void *vm_args, BOOLEAN isJITSer
2095
2103
* result from above.
2096
2104
*/
2097
2105
origLibpath = getenv ("LIBPATH" );
2098
- #endif
2106
+ #endif /* defined(AIXPPC) || (defined(J9ZOS390) && (JAVA_SPEC_VERSION >= 21)) */
2099
2107
2100
2108
/* no tracing for this function, since it's unlikely to be used once the VM is running and the trace engine is initialized */
2101
2109
preloadLibraries ();
0 commit comments