diff -r 396533b75ea0 src/macosx/classes/java/lang/ClassLoaderHelper.java --- a/src/macosx/classes/java/lang/ClassLoaderHelper.java Tue Mar 27 21:08:52 2012 +0100 +++ b/src/macosx/classes/java/lang/ClassLoaderHelper.java Wed Mar 28 10:42:04 2012 +0100 @@ -38,7 +38,7 @@ */ static File mapAlternativeName(File lib) { String name = lib.toString(); - int index = name.lastIndexOf('.'); + int index = name.toLowerCase().lastIndexOf(".dylib"); if (index < 0) { return null; } diff -r 396533b75ea0 src/share/classes/java/lang/ClassLoader.java --- a/src/share/classes/java/lang/ClassLoader.java Tue Mar 27 21:08:52 2012 +0100 +++ b/src/share/classes/java/lang/ClassLoader.java Wed Mar 28 10:42:43 2012 +0100 @@ -1823,7 +1823,8 @@ sys_paths = initializePath("sun.boot.library.path"); } if (isAbsolute) { - if (loadLibrary0(fromClass, new File(name))) { + File libfile = new File(name); + if (loadLibrary0(fromClass, libfile)) { return; } throw new UnsatisfiedLinkError("Can't load library: " + name); @@ -1847,10 +1848,6 @@ if (loadLibrary0(fromClass, libfile)) { return; } - libfile = ClassLoaderHelper.mapAlternativeName(libfile); - if (libfile != null && loadLibrary0(fromClass, libfile)) { - return; - } } if (loader != null) { for (int i = 0 ; i < usr_paths.length ; i++) { @@ -1859,10 +1856,6 @@ if (loadLibrary0(fromClass, libfile)) { return; } - libfile = ClassLoaderHelper.mapAlternativeName(libfile); - if (libfile != null && loadLibrary0(fromClass, libfile)) { - return; - } } } // Oops, it failed @@ -1870,6 +1863,17 @@ } private static boolean loadLibrary0(Class fromClass, final File file) { + if (loadLibrary1(fromClass, file)) { + return true; + } + final File libfile = ClassLoaderHelper.mapAlternativeName(file); + if (libfile != null && loadLibrary1(fromClass, libfile)) { + return true; + } + return false; + } + + private static boolean loadLibrary1(Class fromClass, final File file) { boolean exists = AccessController.doPrivileged( new PrivilegedAction() { public Object run() {