From 7d9e51e9ae6e5be5338e225457b1fdd9f7d62dd7 Mon Sep 17 00:00:00 2001 From: gohai Date: Tue, 17 Dec 2013 00:02:07 -0800 Subject: [PATCH] Appbundler: Add Contents/Java to java.library.path for loadLibrary to find .jnilib files Upon including processing.serial.*, the java.library.path of the sketch - when compiled normally - gets expanded to include the location of the specific library subfolder. For exported sketches on MacOS, java.library.path points just to Contents/MacOS inside the application, which causes loadLibrary inside custom libraries to fail. Since those library files (*.jnilib) get copied into Contents/Java, change the java.library.path to include this location as well. Somewhat confident that this shouldn't break things, but this is touching core infrastructure. --- build/macosx/appbundler/native/main.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/macosx/appbundler/native/main.m b/build/macosx/appbundler/native/main.m index 4a365e304..95a4485c4 100644 --- a/build/macosx/appbundler/native/main.m +++ b/build/macosx/appbundler/native/main.m @@ -185,7 +185,7 @@ int launch(char *commandName) { */ // Set the library path - NSString *libraryPath = [NSString stringWithFormat:@"-Djava.library.path=%@/Contents/MacOS", mainBundlePath]; + NSString *libraryPath = [NSString stringWithFormat:@"-Djava.library.path=:%@/Contents/Java:%@/Contents/MacOS", mainBundlePath, mainBundlePath]; // Get the VM options NSArray *options = [infoDictionary objectForKey:@JVM_OPTIONS_KEY];