4340N/A/*
4340N/A * Copyright (c) 2002-2013, Oracle and/or its affiliates. All rights reserved.
4340N/A * Copyright (c) 2011 SAP AG. All Rights Reserved.
4340N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4340N/A *
4340N/A * This code is free software; you can redistribute it and/or modify it
4340N/A * under the terms of the GNU General Public License version 2 only, as
4340N/A * published by the Free Software Foundation.
4340N/A *
4340N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4340N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4340N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4340N/A * version 2 for more details (a copy is included in the LICENSE file that
4340N/A * accompanied this code).
4340N/A *
4340N/A * You should have received a copy of the GNU General Public License version
4340N/A * 2 along with this work; if not, write to the Free Software Foundation,
4340N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4340N/A *
4340N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4340N/A * or visit www.oracle.com if you need additional information or have any
4340N/A * questions.
4340N/A */
4340N/A
4340N/Aclass Test {
4340N/A
4340N/A static boolean loadLib(String libName){
4340N/A try {
4340N/A System.loadLibrary(libName);
4340N/A System.out.println("Loaded library "+ libName + ".");
4340N/A return true;
4340N/A } catch (SecurityException e) {
4340N/A System.out.println("loadLibrary(\"" + libName + "\") throws: " + e + "\n");
4340N/A } catch (UnsatisfiedLinkError e) {
4340N/A System.out.println("loadLibrary(\"" + libName + "\") throws: " + e + "\n");
4340N/A }
4340N/A return false;
4340N/A }
4340N/A
4340N/A public static int counter = 1;
4340N/A
4340N/A static int Runner() {
4340N/A counter = counter * -1;
4340N/A int i = counter;
4340N/A if(counter < 2) counter += Runner();
4340N/A return i;
4340N/A }
4340N/A
4340N/A public static int run() {
4340N/A try{
4340N/A Runner();
4340N/A } catch (StackOverflowError e) {
4340N/A System.out.println("Caught stack overflow error.");
4340N/A return 0;
4340N/A } catch (OutOfMemoryError e) {
4340N/A return 0;
4340N/A }
4340N/A return 2;
4340N/A }
4340N/A
4340N/A public static void main(String argv[]) {
4340N/A loadLib(argv[0]);
4340N/A System.exit(run());
4340N/A }
4340N/A}