@@ -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
@@ -2060,12 +2060,19 @@ JNI_CreateJavaVM_impl(JavaVM **pvm, void **penv, void *vm_args, BOOLEAN isJITSer
2060
2060
* LIBPATH=/jre/lib/ppc64/j9vm:/jre/lib/ppc64:/jre/lib/ppc64/jli:/jre/../lib/ppc64:/usr/lib
2061
2061
*/
2062
2062
2063
+ /* On z/OS Java 21 and up, if /lib isn't already present in LIBPATH, append it to the end. */
2063
2064
const char * currentLibPath = getenv ("LIBPATH" );
2064
2065
BOOLEAN appendToLibPath = TRUE;
2065
2066
if (NULL != currentLibPath ) {
2066
2067
const size_t currentLibPathLength = strlen (currentLibPath );
2068
+ #if defined(AIXPPC )
2067
2069
const char * usrLib = "/usr/lib" ;
2068
2070
const UDATA usrLibLength = LITERAL_STRLEN ("/usr/lib" );
2071
+ #else /* defined(AIXPPC) */
2072
+ /* on z/OS Java 21+ */
2073
+ const char * usrLib = "/lib" ;
2074
+ const UDATA usrLibLength = LITERAL_STRLEN ("/lib" );
2075
+ #endif /* defined(AIXPPC) */
2069
2076
const char * needle = strstr (currentLibPath , usrLib );
2070
2077
while (NULL != needle ) {
2071
2078
/* Note, inside the loop we're guaranteed to have
@@ -2085,7 +2092,7 @@ JNI_CreateJavaVM_impl(JavaVM **pvm, void **penv, void *vm_args, BOOLEAN isJITSer
2085
2092
}
2086
2093
}
2087
2094
if (appendToLibPath ) {
2088
- addToLibpath ("/usr/lib" , FALSE);
2095
+ addToLibpath (usrLib , FALSE);
2089
2096
}
2090
2097
}
2091
2098
/* CMVC 135358.
0 commit comments