Skip to content

Commit abc7b2d

Browse files
author
gkbrown
committed
Load libjli.dylib directly rather than via bundle.
git-svn-id: https://svn.java.net/svn/appbundler~svn@30 07572b26-92e5-4d45-f66a-c18421440a21
1 parent 91f5509 commit abc7b2d

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

appbundler/native/main.m

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,19 @@ 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 = NULL;
92+
const char *libjliPath = NULL;
9393
if (runtime != nil) {
94-
NSURL *runtimeBundleURL = [[[NSBundle mainBundle] builtInPlugInsURL] URLByAppendingPathComponent:runtime];
95-
CFBundleRef runtimeBundle = CFBundleCreate(NULL, (CFURLRef)runtimeBundleURL);
96-
97-
NSError *bundleLoadError = nil;
98-
Boolean runtimeBundleLoaded = CFBundleLoadExecutableAndReturnError(runtimeBundle, (CFErrorRef *)&bundleLoadError);
99-
if (bundleLoadError == nil && runtimeBundleLoaded) {
100-
jli_LaunchFxnPtr = CFBundleGetFunctionPointerForName(runtimeBundle, CFSTR("JLI_Launch"));
101-
}
94+
NSString *runtimePath = [[[NSBundle mainBundle] builtInPlugInsPath] stringByAppendingPathComponent:runtime];
95+
libjliPath = [[runtimePath stringByAppendingPathComponent:@"Contents/Home/jre/lib/jli/libjli.dylib"] fileSystemRepresentation];
10296
} else {
103-
void *libJLI = dlopen(LIBJLI_DYLIB, RTLD_LAZY);
104-
if (libJLI != NULL) {
105-
jli_LaunchFxnPtr = dlsym(libJLI, "JLI_Launch");
106-
}
97+
libjliPath = LIBJLI_DYLIB;
98+
}
99+
100+
void *libJLI = dlopen(libjliPath, RTLD_LAZY);
101+
102+
JLI_Launch_t jli_LaunchFxnPtr = NULL;
103+
if (libJLI != NULL) {
104+
jli_LaunchFxnPtr = dlsym(libJLI, "JLI_Launch");
107105
}
108106

109107
if (jli_LaunchFxnPtr == NULL) {

appbundler/src/com/oracle/appbundler/AppBundlerTask.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,6 @@ private void copyRuntime(File plugInsDirectory) throws IOException {
352352
File pluginContentsDirectory = new File(pluginDirectory, runtimeContentsDirectory.getName());
353353
pluginContentsDirectory.mkdir();
354354

355-
// Copy MacOS directory
356-
File runtimeMacOSDirectory = new File(runtimeContentsDirectory, "MacOS");
357-
copy(runtimeMacOSDirectory, new File(pluginContentsDirectory, runtimeMacOSDirectory.getName()));
358-
359355
// Copy Info.plist file
360356
File runtimeInfoPlistFile = new File(runtimeContentsDirectory, "Info.plist");
361357
copy(runtimeInfoPlistFile, new File(pluginContentsDirectory, runtimeInfoPlistFile.getName()));

0 commit comments

Comments
 (0)