SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.util.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.

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

Definition at line 42 of file NativeUtils.java.

Member Function Documentation

◆ loadLibraryFromJar()

void umontreal.ssj.util.NativeUtils.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)}).

Definition at line 68 of file NativeUtils.java.


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