summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorStefan Andritoiu <[email protected]>2016-01-26 19:46:20 +0200
committerPetre Eftime <[email protected]>2016-01-27 15:08:14 +0200
commit706445a43828269019851e34861f949a1232ebe0 (patch)
tree4dd4a761778e5874d6879ac0aa28f2063af13305 /java
parent19dd2319b393f7e5ec0610336a6e5741b46c9a4c (diff)
java: Added "autoload library" code
Signed-off-by: Stefan Andritoiu <[email protected]>
Diffstat (limited to 'java')
-rw-r--r--java/BluetoothManager.java9
-rw-r--r--java/BluetoothObject.java9
2 files changed, 18 insertions, 0 deletions
diff --git a/java/BluetoothManager.java b/java/BluetoothManager.java
index 4b137da0..1e3d06d7 100644
--- a/java/BluetoothManager.java
+++ b/java/BluetoothManager.java
@@ -31,6 +31,15 @@ public class BluetoothManager
private long nativeInstance;
private static BluetoothManager inst;
+ static {
+ try {
+ System.loadLibrary("javatinyb");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load.\n" + e);
+ System.exit(-1);
+ }
+ }
+
public native BluetoothType getBluetoothType();
public native BluetoothObject getObject(BluetoothType type, String name,
String identifier, BluetoothObject parent);
diff --git a/java/BluetoothObject.java b/java/BluetoothObject.java
index d4576810..672d10d1 100644
--- a/java/BluetoothObject.java
+++ b/java/BluetoothObject.java
@@ -30,6 +30,15 @@ public class BluetoothObject
{
long nativeInstance;
+ static {
+ try {
+ System.loadLibrary("javatinyb");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load.\n" + e);
+ System.exit(-1);
+ }
+ }
+
/** Returns the BluetoothType of this object
* @return The BluetoothType of this object
*/