Skip to content

Commit

Permalink
(SIGAR-141) sigar.jar location is not required to find native library
Browse files Browse the repository at this point in the history
  • Loading branch information
dougm committed Mar 27, 2009
1 parent 6d6b557 commit 68cf08c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions bindings/java/hyperic_jni/src/org/hyperic/jni/ArchLoader.java
Expand Up @@ -250,6 +250,11 @@ private boolean isJarURL(URL url) {
}

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
Expand Down Expand Up @@ -280,8 +285,13 @@ public String findJarPath(String libName)
}

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();
Expand Down Expand Up @@ -385,11 +395,11 @@ protected void loadLibrary(String path)
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);
}
}
Expand Down

0 comments on commit 68cf08c

Please sign in to comment.