RFR: 7134701 [macosx] Support legacy native library names

Alan Bateman Alan.Bateman at oracle.com
Wed Mar 28 07:40:58 UTC 2012

On 28/03/2012 04:51, Scott Kovatch wrote:
> With this patch in place I can load the applet at Runescape.com now. I can't log in yet due to an AWT bug I probably haven't patched yet, but this is better than what it was.
> Minecraft.net is still giving me problems because it's bailing out before this change takes place. Here's the method in question:
> private static void doLoadLibrary(final String lib_name) {
> 	AccessController.doPrivileged(new PrivilegedAction<Object>() {
> 		public Object run() {
> 			String library_path = System.getProperty("org.lwjgl.librarypath");
> 			if (library_path != null) {
> 				System.load(library_path + File.separator +
> 					System.mapLibraryName(lib_name));
> 			} else {
> 				System.loadLibrary(lib_name);
> 			}
> 			return null;
> 		}
> 	});
> }
> It's failing because System.mapLibraryName is constructing a library named liblwjgl.dylib, but lwjgl only has 'liblwjgl.jnilib'. Apple's JDK 6 (and I suspect macosx-port) gives me 'liblwjgl.jnilib' for System.mapLibraryName("lwjgl").
> I can't even get this far with Apple's JDK 6 on minecraft.net, so it's hard to say this is a pure regression. I'm hesitant to suggest that we have mapLibraryName start returning a library named lib<xxx>.jnilib at this point.
> Any ideas for a workaround? I think your ClassLoader/System change shown here should still go in, but in this particular case we still have problems. I don't know how much code is out there that uses mapLibraryName in this way.
> -- Scott
I just checked a Mac OSX 10.6.8 system with 6u29 installed and 
System.mapLibraryName("foo") returns foo.jnilib. Do you know if this was 
always the case? If so then I think there is an argument to be made that 
the default should be .jnilib and .dynlib be the fallback, especially if 
it's going to break anyone using mapLibraryName (my guess is that 
mapLibraryName usages are rare, at least compared to System.loadLibrary).


More information about the core-libs-dev mailing list