summaryrefslogtreecommitdiff
path: root/Examples/java/native/runme.java
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/java/native/runme.java')
-rw-r--r--Examples/java/native/runme.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/Examples/java/native/runme.java b/Examples/java/native/runme.java
new file mode 100644
index 0000000..e9a18b2
--- /dev/null
+++ b/Examples/java/native/runme.java
@@ -0,0 +1,19 @@
+
+public class runme {
+
+ static {
+ try {
+ System.loadLibrary("example");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ SWIGTYPE_p_Point p = example.point_create(1, 2);
+ System.out.println("auto wrapped : " + example.point_toString1(p));
+ System.out.println("manual wrapped: " + example.point_toString2(p));
+ example.free(new SWIGTYPE_p_void(SWIGTYPE_p_Point.getCPtr(p), false)); //clean up c allocated memory
+ }
+}