NativeLoader: $(CWD)/native/... als Ladequelle hinzugefügt

master
Harald Wolff 2016-12-14 10:49:41 +01:00
parent 723e515970
commit 2b82d4e021
1 changed files with 18 additions and 0 deletions

View File

@ -34,6 +34,12 @@ public class NativeLoader {
public static String nativeResourceName(String libName){
return String.format("/native/%s/%s", Platform.PlatformName(), nativeLibraryName(libName));
}
public static String nativeLocalResourceName(String libName){
return String.format("native%s%s%s%s", File.separator, Platform.PlatformName(), File.separator, nativeLibraryName(libName));
}
/*
* loadLibrary()
@ -68,6 +74,18 @@ public class NativeLoader {
{
System.err.println(String.format("NativeLoader.loadLibrary(): System.load('%s') erfolglos",libFileName));
};
String nativeLocalResourceName = new File("").getAbsolutePath() + File.separator + nativeLocalResourceName(libName);
try
{
System.load(nativeLocalResourceName);
System.out.println(String.format("NativeLoader.loadLibrary(): System.load('%s') erfolgreich",nativeLocalResourceName));
return;
} catch (UnsatisfiedLinkError e)
{
System.err.println(String.format("NativeLoader.loadLibrary(): System.load('%s') erfolglos",nativeLocalResourceName));
};
String nativeResourceName = nativeResourceName(libName);
try