From 3d3aa0be17cc8d35e251ea3594b1e684ce919d0d Mon Sep 17 00:00:00 2001 From: Nick Aldwin Date: Tue, 7 Oct 2014 15:30:26 -0400 Subject: [PATCH] Ensure absolute path is used for library [`System#load`][1] requires an absolute path. If the extraction directory (`library.${name}.path` or `java.io.tmpdir`) is relative, the extraction will succeed, but the `System#load` call will fail, resulting in the library not being loaded. This commit rectifies that by obtaining the absolute path to the directory before extracting. [1]: http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#load(java.lang.String) --- .../src/main/java/org/fusesource/hawtjni/runtime/Library.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java b/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java index 422bd2fc..96bc1b59 100755 --- a/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java +++ b/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java @@ -262,6 +262,9 @@ private String map(String libName) { private File extract(ArrayList errors, URL source, String prefix, String suffix, File directory) { File target = null; + if (directory != null) { + directory = directory.getAbsoluteFile(); + } try { FileOutputStream os = null; InputStream is = null;