From 9f22a701cc26b68a597e78faf652124fab25fec9 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 20 Dec 2012 12:25:13 -0700 Subject: [PATCH] load libmawt.so proactively when booting the VM for OpenJDK This library is placed in the xawt subdirectory of jre/lib/$arch on POSIX systems, so it isn't found automatically when third-party libraries which depend on it are loaded. The simplest way to ensure that it's found seems to be to just load it when the VM starts up. --- src/classpath-openjdk.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/classpath-openjdk.cpp b/src/classpath-openjdk.cpp index b06211777f..4842ab8581 100644 --- a/src/classpath-openjdk.cpp +++ b/src/classpath-openjdk.cpp @@ -439,17 +439,20 @@ class MyClasspath : public Classpath { unsigned libraryPathOffset = sb.offset; sb.append(javaHome); #ifdef PLATFORM_WINDOWS - sb.append("/bin"); +# define LIB_DIR "/bin" #elif defined __APPLE__ - sb.append("/lib"); +# define LIB_DIR "/lib" #elif defined ARCH_x86_64 - sb.append("/lib/amd64"); +# define LIB_DIR "/lib/amd64" #elif defined ARCH_arm - sb.append("/lib/arm"); +# define LIB_DIR "/lib/arm" #else // todo: handle other architectures - sb.append("/lib/i386"); +# define LIB_DIR "/lib/i386" #endif + sb.append(LIB_DIR ":"); + sb.append(javaHome); + sb.append(LIB_DIR "/xawt"); sb.append('\0'); unsigned tzMappingsOffset = sb.offset; @@ -635,6 +638,7 @@ class MyClasspath : public Classpath { #else // not AVIAN_OPENJDK_SRC expect(t, loadLibrary(t, libraryPath, "verify", true, true)); expect(t, loadLibrary(t, libraryPath, "java", true, true)); + loadLibrary(t, libraryPath, "mawt", true, true); #endif // not AVIAN_OPENJDK_SRC { object assertionLock = resolveField