From 73d6e98bf29526eb2c4dd8750f7695a85aada66e Mon Sep 17 00:00:00 2001 From: Thad House Date: Mon, 18 Jan 2016 22:39:21 -0800 Subject: [PATCH] Loads ntcore from path if extracted load fails There's a lot of buzz going around the internet about people trying to get ntcore working on other devices. One of the things that makes it harder is having to have a separate jar for each platform. What this change does is if the loading of the extracted library fails, it will attempt to load ntcore from the path. This means that a program like GRIP can just provide the libntcore.so and not have to worry about compiling different versions for different platforms. --- .../wpi/first/wpilibj/networktables/NetworkTablesJNI.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/java/src/edu/wpi/first/wpilibj/networktables/NetworkTablesJNI.java b/java/src/edu/wpi/first/wpilibj/networktables/NetworkTablesJNI.java index 810d7f89f2..5708a2e133 100644 --- a/java/src/edu/wpi/first/wpilibj/networktables/NetworkTablesJNI.java +++ b/java/src/edu/wpi/first/wpilibj/networktables/NetworkTablesJNI.java @@ -51,8 +51,11 @@ public class NetworkTablesJNI { os.close(); is.close(); } - - System.load(jniLibrary.getAbsolutePath()); + try { + System.load(jniLibrary.getAbsolutePath()); + } catch (UnsatisfiedLinkError e) { + System.loadLibrary("ntcore"); + } } else { System.loadLibrary("ntcore"); }