SSJ  3.3.1
Stochastic Simulation in Java
Static Public Member Functions | List of all members
NativeUtils Class Reference

A simple library class which helps with loading dynamic libraries stored in the JAR archive. More...

Static Public Member Functions

static void loadLibraryFromJar (String path) throws IOException
 Loads library from current JAR archive. More...
 

Detailed Description

A simple library class which helps with loading dynamic libraries stored in the JAR archive.

These libraries usually contain implementation of some methods in native code (using JNI - Java Native Interface).

See also
http://adamheinrich.com/blog/2012/how-to-load-native-jni-library-from-jar
https://github.com/adamheinrich/native-utils

Member Function Documentation

◆ loadLibraryFromJar()

static void loadLibraryFromJar ( String  path) throws IOException
static

Loads library from current JAR archive.

The file from JAR is copied into system temporary directory and then loaded. The temporary file is deleted after exiting. Method uses String as filename because the pathname is "abstract", not system-dependent.

Parameters
pathThe absolute path to the filename inside JAR (beginning with '/'), e.g. /package/File.ext
Exceptions
IOExceptionIf temporary file creation or read/write operation fails
IllegalArgumentExceptionIf source file (param path) does not exist
IllegalArgumentExceptionIf the path is not absolute or if the filename is shorter than three characters (restriction of {
See also
File::createTempFile(java.lang.String, java.lang.String)}).

The documentation for this class was generated from the following file: