/tags/rel-1-3-29/SWIG/Examples/test-suite/java/using_pointers_runme.java

# · Java · 32 lines · 28 code · 4 blank · 0 comment · 2 complexity · 93265aee3b0869a56af1dcf4b9b5ec63 MD5 · raw file

  1. import using_pointers.*;
  2. public class using_pointers_runme {
  3. static {
  4. try {
  5. System.loadLibrary("using_pointers");
  6. } catch (UnsatisfiedLinkError e) {
  7. 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);
  8. System.exit(1);
  9. }
  10. }
  11. public static void main(String argv[])
  12. {
  13. FooBar f = new FooBar();
  14. boolean pass = true;
  15. try {
  16. f.exception_spec(1);
  17. pass = false;
  18. } catch (RuntimeException e) {
  19. }
  20. if (!pass) throw new RuntimeException("Missed exception 1");
  21. try {
  22. f.exception_spec(2);
  23. pass = false;
  24. } catch (RuntimeException e) {
  25. }
  26. if (!pass) throw new RuntimeException("Missed exception 2");
  27. }
  28. }