(SIGAR-141) sigar.jar location is not required to find native library

This commit is contained in:
Doug MacEachern 2009-03-27 15:07:32 -07:00
parent 4333771fc3
commit 9eade5d21a
1 changed files with 14 additions and 4 deletions

View File

@ -250,6 +250,11 @@ public class ArchLoader {
} }
public String findJarPath(String libName) public String findJarPath(String libName)
throws ArchLoaderException {
return findJarPath(libName, true);
}
private String findJarPath(String libName, boolean isRequired)
throws ArchLoaderException { throws ArchLoaderException {
/* /*
* native libraries should be installed along side * native libraries should be installed along side
@ -280,9 +285,14 @@ public class ArchLoader {
} }
if (url == null) { if (url == null) {
if (isRequired) {
throw new ArchLoaderException("Unable to find " + throw new ArchLoaderException("Unable to find " +
getJarName()); getJarName());
} }
else {
return null;
}
}
path = url.getFile(); path = url.getFile();
@ -385,11 +395,11 @@ public class ArchLoader {
if (path.equals("-")) { if (path.equals("-")) {
return; //assume library is already loaded return; //assume library is already loaded
} }
findJarPath(null); //check for versioned .jar findJarPath(null, false); //check for versioned .jar
findNativeLibrary(path, libName); findNativeLibrary(path, libName);
} }
else { else {
if (findJarPath(libName) == null) { if (findJarPath(libName, false) == null) {
findInJavaLibraryPath(libName); findInJavaLibraryPath(libName);
} }
} }