added a class I found to load JNI code from within JAR files on non-android platforms.
That doesn't come for free, unlike android.
This commit is contained in:
parent
52df59c552
commit
75d7137025
2 changed files with 112 additions and 1 deletions
|
@ -31,13 +31,31 @@ import java.nio.ByteBuffer;
|
|||
import java.lang.Long;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* A ZeroTier One node
|
||||
*/
|
||||
public class Node {
|
||||
static {
|
||||
System.loadLibrary("ZeroTierOneJNI");
|
||||
try {
|
||||
System.loadLibrary("ZeroTierOneJNI");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
try {
|
||||
if(System.getProperty("os.name").startsWith("Windows")) {
|
||||
System.out.println("Arch: " + System.getProperty("sun.arch.data.model"));
|
||||
if(System.getProperty("sun.arch.data.model").equals("64")) {
|
||||
NativeUtils.loadLibraryFromJar("/lib/ZeroTierOneJNI_win64.dll");
|
||||
} else {
|
||||
NativeUtils.loadLibraryFromJar("/lib/ZeroTierOneJNI_win32.dll");
|
||||
}
|
||||
} else {
|
||||
// TODO: Mac
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final String TAG = "NODE";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue