IDEA-233043 Update IDEA launcher to use JBR without symlink to libjli.dylib

GitOrigin-RevId: 2cc7153be32a613f9b55a2d0843e40bc2830d886
This commit is contained in:
Alexey Ushakov
2020-02-14 20:48:48 +03:00
committed by intellij-monorepo-bot
parent bed7f40bd1
commit b3c7efab4a

View File

@@ -552,8 +552,20 @@ BOOL validationJavaVersion(){
jint create_vm_rc = create_vm(&jvm, &env, &args);
if (create_vm_rc != JNI_OK || jvm == NULL) {
NSLog(@"JNI_CreateJavaVM (%@) failed: %ld", vm.bundlePath, create_vm_rc);
exit(-1);
NSString *serverLibUrl = [vm.bundlePath stringByAppendingPathComponent:@"Contents/Home/lib/server/libjvm.dylib"];
void *libHandle = dlopen(serverLibUrl.UTF8String, RTLD_NOW + RTLD_GLOBAL);
if (libHandle) {
create_vm = dlsym(libHandle, "JNI_CreateJavaVM");
}
if (create_vm != NULL) {
create_vm_rc = create_vm(&jvm, &env, &args);
}
if (create_vm == NULL || create_vm_rc != JNI_OK) {
NSLog(@"JNI_CreateJavaVM (%@) failed: %ld", vm.bundlePath, create_vm_rc);
exit(-1);
}
}
jclass string_class = (*env)->FindClass(env, "java/lang/String");