Class NativeUtil
- java.lang.Object
-
- com.github.weisj.darklaf.platform.NativeUtil
-
public class NativeUtil extends Object
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).
-
-
Field Summary
Fields Modifier and Type Field Description static StringNATIVE_FOLDER_PATH_PREFIX
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidloadLibraryFromJar(String path)Loads library from current JAR archive
-
-
-
Field Detail
-
NATIVE_FOLDER_PATH_PREFIX
public static final String NATIVE_FOLDER_PATH_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
loadLibraryFromJar
public static void loadLibraryFromJar(String path) throws IOException
Loads 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 path of file inside JAR as absolute path (beginning with '/'), e.g. /package/File.ext- Throws:
IOException- If temporary file creation or read/write operation failsIllegalArgumentException- If source file (param path) does not existIllegalArgumentException- If the path is not absolute or if the filename is shorter than three characters (restriction ofFile.createTempFile(java.lang.String, java.lang.String)).FileNotFoundException- If the file could not be found inside the JAR.
-
-