Class NativeLibrary


  • public class NativeLibrary
    extends Object
    Helper class to load native library (.dll, .so or .dylib) stored in Jar.

    Copies native library to users temporary folder before loading it.

    Since:
    1.1
    • Constructor Detail

      • NativeLibrary

        public NativeLibrary​(String libraryName,
                             ClassLoader classLoader,
                             boolean supported)
        Load native library from given classloader.

        Note regarding Java Platform Module System (JPMS): If classloader is null, the library can be only loaded from the module that contains this class. If classloader is not null, then the package that contains the library must be specified as "open" in module-info.java of the module that contains the library.

        Parameters:
        libraryName - resource name of the native library (without "lib" prefix and without extension)
        classLoader - the classloader used to locate the library, or null
        supported - whether the native library is supported on the current platform
    • Method Detail

      • isLoaded

        public boolean isLoaded()
        Returns whether the native library is loaded.

        Returns false if not supported on current platform as specified in constructor or if loading failed.