@@ -89,20 +89,16 @@ int launch(char *commandName) {
8989 // Locate the JLI_Launch() function
9090 NSString *runtime = [infoDictionary objectForKey: @JVM_RUNTIME_KEY];
9191
92- JLI_Launch_t jli_LaunchFxnPtr;
92+ JLI_Launch_t jli_LaunchFxnPtr = NULL ;
9393 if (runtime != nil ) {
9494 NSURL *runtimeBundleURL = [[[NSBundle mainBundle ] builtInPlugInsURL ] URLByAppendingPathComponent: runtime];
9595 CFBundleRef runtimeBundle = CFBundleCreate (NULL , (CFURLRef)runtimeBundleURL);
9696
9797 NSError *bundleLoadError = nil ;
9898 Boolean runtimeBundleLoaded = CFBundleLoadExecutableAndReturnError (runtimeBundle, (CFErrorRef *)&bundleLoadError);
99- if (bundleLoadError != nil || !runtimeBundleLoaded) {
100- [[NSException exceptionWithName: @JAVA_LAUNCH_ERROR
101- reason: NSLocalizedString(@" JRELoadError" , @UNSPECIFIED_ERROR)
102- userInfo: nil ] raise ];
99+ if (bundleLoadError == nil && runtimeBundleLoaded) {
100+ jli_LaunchFxnPtr = CFBundleGetFunctionPointerForName (runtimeBundle, CFSTR (" JLI_Launch" ));
103101 }
104-
105- jli_LaunchFxnPtr = CFBundleGetFunctionPointerForName (runtimeBundle, CFSTR (" JLI_Launch" ));
106102 } else {
107103 void *libJLI = dlopen (LIBJLI_DYLIB, RTLD_LAZY);
108104 if (libJLI != NULL ) {
@@ -112,7 +108,7 @@ int launch(char *commandName) {
112108
113109 if (jli_LaunchFxnPtr == NULL ) {
114110 [[NSException exceptionWithName: @JAVA_LAUNCH_ERROR
115- reason: NSLocalizedString(@" JRENotFound " , @UNSPECIFIED_ERROR)
111+ reason: NSLocalizedString(@" JRELoadError " , @UNSPECIFIED_ERROR)
116112 userInfo: nil ] raise ];
117113 }
118114
0 commit comments