Class NativeLibraryLoader

java.lang.Object
com.sun.star.lib.util.NativeLibraryLoader

public final class NativeLibraryLoader extends Object
Helper functions to locate and load native files.

The methods in this class are designed to find the requested resources in as many cases as possible. They search various places, roughly from most specific to most general. This works well if a component is known to bring with it a certain resource, and that resource has to be found. However, it might not work very well in cases where you want to check whether a component brings with it a certain resource or not: a similarly named resource from another component might be found by the eager search algorithm.

  • Method Details

    • loadLibrary

      public static void loadLibrary(ClassLoader loader, String libname)
      Load a system library, using a given class loader to locate the library.

      This is similar to System.loadLibrary.

      Parameters:
      loader - a class loader; may be null.
      libname - the library name; how this name is mapped to a system library name is system dependent.
    • getResource

      public static File getResource(ClassLoader loader, String name)
      Locate a system resource, using a given class loader.

      This is similar to ClassLoader.getResource, but only works for local resources (local files), and adds additional functionality for URLClassLoaders.

      Parameters:
      loader - a class loader; may be null.
      name - a resource name (that is, the name of a file).
      Returns:
      a File locating the resource, or null if the resource was not found.