Package club.minnced.opus.util
Class NativeUtil
- java.lang.Object
-
- club.minnced.opus.util.NativeUtil
-
public class NativeUtil extends java.lang.ObjectThis is taken directly from: https://github.com/adamheinrich/native-utils
Credit to the original author: Adam HeinrichA 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).
http://adamheinrich.com/blog/2012/how-to-load-native-jni-library-from-jar
https://github.com/adamheinrich/native-utils
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidloadLibraryFromJar(java.lang.String path)Loads library from current JAR archive
-
-
-
Method Detail
-
loadLibraryFromJar
public static void loadLibraryFromJar(java.lang.String path) throws java.io.IOExceptionLoads library from current JAR archiveThe 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:
path- The filename inside JAR as absolute path (beginning with '/'), e.g. /package/File.ext- Throws:
java.io.IOException- If temporary file creation or read/write operation failsjava.lang.IllegalArgumentException- If source file (param path) does not existjava.lang.IllegalArgumentException- If the path is not absolute or if the filename is shorter than three characters (restriction ofFile.createTempFile(java.lang.String, java.lang.String)).
-
-