1 /*
   2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2018, Google and/or its affiliates. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 package nsk.share.ExceptionCheckingJniEnv;
  26 
  27 import java.io.PrintStream;
  28 
  29 public class exceptionjni001 {
  30     static {
  31         try {
  32             System.loadLibrary("exceptionjni001");
  33         } catch (UnsatisfiedLinkError ule) {
  34             System.err.println("Could not load exceptionjni001 library");
  35             System.err.println("java.library.path:"
  36                 + System.getProperty("java.library.path"));
  37             throw ule;
  38         }
  39     }
  40 
  41     // A field the JNI code can try to get.
  42     int anInteger;
  43 
  44     // Check the exception checking code.
  45     native static boolean check();
  46 
  47     public static void main(String args[]) {
  48       if (!check()) {
  49         throw new RuntimeException("Problem with ExceptionCheckingJniEnv");
  50       }
  51     }
  52 }