From 9eade5d21a32e6c1a5446193924463b7f14b717c Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 27 Mar 2009 15:07:32 -0700 Subject: [PATCH] (SIGAR-141) sigar.jar location is not required to find native library --- .../src/org/hyperic/jni/ArchLoader.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bindings/java/hyperic_jni/src/org/hyperic/jni/ArchLoader.java b/bindings/java/hyperic_jni/src/org/hyperic/jni/ArchLoader.java index 34091b6e..634ecc09 100644 --- a/bindings/java/hyperic_jni/src/org/hyperic/jni/ArchLoader.java +++ b/bindings/java/hyperic_jni/src/org/hyperic/jni/ArchLoader.java @@ -250,6 +250,11 @@ public class ArchLoader { } public String findJarPath(String libName) + throws ArchLoaderException { + return findJarPath(libName, true); + } + + private String findJarPath(String libName, boolean isRequired) throws ArchLoaderException { /* * native libraries should be installed along side @@ -280,8 +285,13 @@ public class ArchLoader { } if (url == null) { - throw new ArchLoaderException("Unable to find " + - getJarName()); + if (isRequired) { + throw new ArchLoaderException("Unable to find " + + getJarName()); + } + else { + return null; + } } path = url.getFile(); @@ -385,11 +395,11 @@ public class ArchLoader { if (path.equals("-")) { return; //assume library is already loaded } - findJarPath(null); //check for versioned .jar + findJarPath(null, false); //check for versioned .jar findNativeLibrary(path, libName); } else { - if (findJarPath(libName) == null) { + if (findJarPath(libName, false) == null) { findInJavaLibraryPath(libName); } }