@@ -948,7 +948,7 @@ public static String load() {
948948 return load (getCallerClass (2 ), loadProperties (), Loader .pathsFirst );
949949 }
950950 /**
951- * Loads native libraries associated with the {@link Class} of the caller.
951+ * Loads native libraries associated with the {@link Class} of the caller and initializes it .
952952 *
953953 * @param pathsFirst search the paths first before bundled resources
954954 * @return {@code load(getCallerClass(2), loadProperties(), pathsFirst) }
@@ -964,9 +964,9 @@ public static String load(Class cls) {
964964 return load (cls , loadProperties (), Loader .pathsFirst );
965965 }
966966 /**
967- * Loads native libraries associated with the given {@link Class}.
967+ * Loads native libraries associated with the given {@link Class} and initializes it .
968968 *
969- * @param cls the Class to get native library information from
969+ * @param cls the Class to get native library information from and to initialize
970970 * @param properties the platform Properties to inherit
971971 * @param pathsFirst search the paths first before bundled resources
972972 * @return the full path to the main file loaded, or the library name if unknown
@@ -977,6 +977,8 @@ public static String load(Class cls) {
977977 * @see #loadLibrary(URL[], String)
978978 */
979979 public static String load (Class cls , Properties properties , boolean pathsFirst ) {
980+ Class classToLoad = cls ;
981+
980982 if (!isLoadLibraries () || cls == null ) {
981983 return null ;
982984 }
@@ -999,6 +1001,12 @@ public static String load(Class cls, Properties properties, boolean pathsFirst)
9991001 }
10001002 targets .add (cls .getName ());
10011003 }
1004+
1005+ // Make sure that we also initialize the class that was passed explicitly
1006+ if (!targets .contains (classToLoad .getName ())) {
1007+ targets .add (classToLoad .getName ());
1008+ }
1009+
10021010 for (String s : targets ) {
10031011 try {
10041012 if (logger .isDebugEnabled ()) {
0 commit comments