diff --git a/src/share/native/java/lang/ClassLoader.c b/src/share/native/java/lang/ClassLoader.c index 47c41b2bd84a7e2b57c7075c09c0f429335355bf..776b2dd24e7d8d102d9cead9a4c82902f07860ed 100644 --- a/src/share/native/java/lang/ClassLoader.c +++ b/src/share/native/java/lang/ClassLoader.c @@ -398,7 +398,9 @@ Java_java_lang_ClassLoader_00024NativeLibrary_load if (cause) { (*env)->ExceptionClear(env); (*env)->Throw(env, cause); - JVM_UnloadLibrary(handle); + if (!isBuiltin) { + JVM_UnloadLibrary(handle); + } goto done; } @@ -409,7 +411,9 @@ Java_java_lang_ClassLoader_00024NativeLibrary_load "unsupported JNI version 0x%08X required by %s", jniVersion, cname); JNU_ThrowByName(env, "java/lang/UnsatisfiedLinkError", msg); - JVM_UnloadLibrary(handle); + if (!isBuiltin) { + JVM_UnloadLibrary(handle); + } goto done; } (*env)->SetIntField(env, this, jniVersionID, jniVersion); @@ -458,7 +462,9 @@ Java_java_lang_ClassLoader_00024NativeLibrary_unload (*env)->GetJavaVM(env, &jvm); (*JNI_OnUnload)(jvm, NULL); } - JVM_UnloadLibrary(handle); + if (!isBuiltin) { + JVM_UnloadLibrary(handle); + } JNU_ReleaseStringPlatformChars(env, name, cname); }