aboutsummaryrefslogtreecommitdiff
path: root/swig/java/test.java
diff options
context:
space:
mode:
authorJamie Bullock <jamie@postlude.co.uk>2007-09-06 14:05:37 +0000
committerJamie Bullock <jamie@postlude.co.uk>2007-09-06 14:05:37 +0000
commit1f22cd5a7ddd3030c0c47f0528f5b2068f6b5283 (patch)
treeca4cb41e59e4c8b2a98df3a166e48d38df526d3a /swig/java/test.java
parent29e943f0788bff5a51005241574cb881fbf26ac7 (diff)
downloadLibXtract-1f22cd5a7ddd3030c0c47f0528f5b2068f6b5283.tar.gz
LibXtract-1f22cd5a7ddd3030c0c47f0528f5b2068f6b5283.tar.bz2
LibXtract-1f22cd5a7ddd3030c0c47f0528f5b2068f6b5283.zip
Java bindings (with simple test) now working. Unified Python and Java bindings tests.
Diffstat (limited to 'swig/java/test.java')
-rw-r--r--swig/java/test.java24
1 files changed, 21 insertions, 3 deletions
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");
+
}
}