Kaydet (Commit) 0d396800 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

More java.lang.System.mapLibraryName dylib vs. jnilib confusion

...like a76261ac

Change-Id: I803dc81344efb5e8021d9ef4146c06ecf82ca63b
üst f759239d
...@@ -78,6 +78,15 @@ public class LocalOfficeConnection ...@@ -78,6 +78,15 @@ public class LocalOfficeConnection
// load libofficebean.so/officebean.dll // load libofficebean.so/officebean.dll
String aSharedLibName = getProgramPath() + java.io.File.separator + String aSharedLibName = getProgramPath() + java.io.File.separator +
System.mapLibraryName(OFFICE_LIB_NAME); System.mapLibraryName(OFFICE_LIB_NAME);
// At least Oracle's 1.7.0_51 now maps to .dylib rather than .jnilib:
if (System.getProperty("os.name").startsWith("Mac")
&& aSharedLibName.endsWith(".dylib"))
{
aSharedLibName
= aSharedLibName.substring(
0, aSharedLibName.length() - "dylib".length())
+ "jnilib";
}
System.load( aSharedLibName ); System.load( aSharedLibName );
} }
......
...@@ -43,7 +43,16 @@ public final class NativeLibraryLoader { ...@@ -43,7 +43,16 @@ public final class NativeLibraryLoader {
library name is system dependent library name is system dependent
*/ */
public static void loadLibrary(ClassLoader loader, String libname) { public static void loadLibrary(ClassLoader loader, String libname) {
File path = getResource(loader, System.mapLibraryName(libname)); String sysname = System.mapLibraryName(libname);
// At least Oracle's 1.7.0_51 now maps to .dylib rather than .jnilib:
if (System.getProperty("os.name").startsWith("Mac")
&& sysname.endsWith(".dylib"))
{
sysname
= sysname.substring(0, sysname.length() - "dylib".length())
+ "jnilib";
}
File path = getResource(loader, sysname);
if (path == null) { if (path == null) {
// If the library cannot be found as a class loader resource, try // If the library cannot be found as a class loader resource, try
// the global System.loadLibrary as a last resort: // the global System.loadLibrary as a last resort:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment