Applied a patch from Alec Wysoker for finding snappy DLL via java.library.path

This commit is contained in:
Taro L. Saito 2011-05-26 11:14:01 +09:00
parent 6771e58b46
commit 85d9cc9084

View File

@ -187,20 +187,20 @@ public class LoadSnappy
// Load the os-dependent library from a jar file // Load the os-dependent library from a jar file
snappyNativeLibraryPath = "/org/xerial/snappy/native/" + OSInfo.getNativeLibFolderPathForCurrentOS(); snappyNativeLibraryPath = "/org/xerial/snappy/native/" + OSInfo.getNativeLibFolderPathForCurrentOS();
if (LoadSnappy.class.getResource(snappyNativeLibraryPath + "/" + snappyNativeLibraryName) == null) { if (LoadSnappy.class.getResource(snappyNativeLibraryPath + "/" + snappyNativeLibraryName) != null) {
// use nested VM version // Temporary library folder. Use the value of java.io.tmpdir
return; String tempFolder = new File(System.getProperty("java.io.tmpdir")).getAbsolutePath();
// Try extracting the library from jar
if (extractAndLoadLibraryFile(snappyNativeLibraryPath, snappyNativeLibraryName, tempFolder)) {
return;
}
} }
try {
// Temporary library folder. Use the value of java.io.tmpdir System.loadLibrary("snappy");
String tempFolder = new File(System.getProperty("java.io.tmpdir")).getAbsolutePath();
// Try extracting the library from jar
if (extractAndLoadLibraryFile(snappyNativeLibraryPath, snappyNativeLibraryName, tempFolder)) {
isLoaded = true; isLoaded = true;
return; } catch (UnsatisfiedLinkError e) {
isLoaded = false;
} }
isLoaded = false;
return; return;
} }