Skip to content
Java helper for loading native libraries from jar files
Java C
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

This is a utility library for loading native libraries from the classpath. The JVM is unable to load libraries from inside .jar files. This class works around that by copying them out to a temporary directory on the filesystem.

When using this utility class, imagine you are registering all versions of your native library. It would be used like this,

try {
    NativeGuide.prepare(Arch.LINUX_32, "x86/");
    NativeGuide.prepare(Arch.LINUX_64, "amd64/");
    NativeGuide.prepare(Arch.WINDOWS_32, "x86/example.dll");
    NativeGuide.prepare(Arch.WINDOWS_64, "amd64/example.dll");
} catch ( e) {
    LOG.severe("Could not prepare the native libraries.");
    throw e;

Libraries not used by the running architecture are ignored.

See also:

Something went wrong with that request. Please try again.