From 1f22cd5a7ddd3030c0c47f0528f5b2068f6b5283 Mon Sep 17 00:00:00 2001 From: Jamie Bullock Date: Thu, 6 Sep 2007 14:05:37 +0000 Subject: Java bindings (with simple test) now working. Unified Python and Java bindings tests. --- swig/java/test.java | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'swig/java/test.java') diff --git a/swig/java/test.java b/swig/java/test.java index d20461a..8949826 100644 --- a/swig/java/test.java +++ b/swig/java/test.java @@ -3,7 +3,16 @@ import xtract.core.*; public class test { public static void main(String argv[]) { -// System.loadLibrary("xtract"); + + try { + System.loadLibrary("jxtract"); + } + catch (UnsatisfiedLinkError e) { + System.out.println("Failed to load the library \"jxtract\""); + System.out.println(e.toString()); + } + + System.out.println("\nRunning libxtract Java bindings test...\n"); int len = 5; int retval = 0; @@ -13,11 +22,20 @@ public class test { result = new float[1]; - for (int i = 0; i < len; i++) + System.out.print("The mean of: "); + + for (int i = 0; i < len; i++){ + System.out.print(i * 2 + ", "); a.setitem(i, i * 2); + } + + System.out.print("is: "); retval = xtract.xtract_mean(a.cast(), len, myvoid, result); - System.out.println(result); + System.out.print(result[0] + "\n"); + + System.out.println("\nFinished!\n\n"); + } } -- cgit v1.2.3