< prev index next >

test/jdk/javax/management/loading/LibraryLoader/LibraryLoaderTest.java

Print this page
rev 59383 : [mq]: final
   1 /*
   2  * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  41 import javax.management.ObjectInstance;
  42 import javax.management.ObjectName;
  43 import javax.management.ReflectionException;
  44 
  45 public class LibraryLoaderTest {
  46 
  47     private static final String mletInfo[][] = {
  48         {"testDomain:type=MLet,index=0", "UseNativeLib0.html"},
  49         {"testDomain:type=MLet,index=1", "UseNativeLib1.html"}
  50     };
  51 
  52     public static void main(String args[]) throws Exception {
  53 
  54         String osName = System.getProperty("os.name");
  55         System.out.println("os.name=" + osName);
  56         String osArch = System.getProperty("os.arch");
  57         System.out.println("os.name=" + osArch);
  58 
  59         // Check for supported platforms:
  60         //
  61         // Solaris/SPARC and Windows/x86
  62         //
  63         if ((!(osName.equals("SunOS") && osArch.equals("sparc"))) &&
  64             (!(osName.startsWith("Windows") && osArch.equals("x86")))) {
  65             System.out.println(
  66               "This test runs only on Solaris/SPARC and Windows/x86 platforms");
  67             System.out.println("Bye! Bye!");
  68             return;
  69         }
  70 
  71         String libPath = System.getProperty("java.library.path");
  72         System.out.println("java.library.path=" + libPath);
  73         String testSrc = System.getProperty("test.src");
  74         System.out.println("test.src=" + testSrc);
  75         String workingDir = System.getProperty("user.dir");
  76         System.out.println("user.dir=" + workingDir);
  77 
  78         String urlCodebase;
  79         if (testSrc.startsWith("/")) {
  80             urlCodebase =
  81                 "file:" + testSrc.replace(File.separatorChar, '/') + "/";
  82         } else {
  83             urlCodebase =
  84                 "file:/" + testSrc.replace(File.separatorChar, '/') + "/";
  85         }
  86 


   1 /*
   2  * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  41 import javax.management.ObjectInstance;
  42 import javax.management.ObjectName;
  43 import javax.management.ReflectionException;
  44 
  45 public class LibraryLoaderTest {
  46 
  47     private static final String mletInfo[][] = {
  48         {"testDomain:type=MLet,index=0", "UseNativeLib0.html"},
  49         {"testDomain:type=MLet,index=1", "UseNativeLib1.html"}
  50     };
  51 
  52     public static void main(String args[]) throws Exception {
  53 
  54         String osName = System.getProperty("os.name");
  55         System.out.println("os.name=" + osName);
  56         String osArch = System.getProperty("os.arch");
  57         System.out.println("os.name=" + osArch);
  58 
  59         // Check for supported platforms:
  60         //
  61         // Windows/x86
  62         //
  63         if ((!(osName.startsWith("Windows") && osArch.equals("x86")))) {

  64             System.out.println(
  65               "This test runs only on Windows/x86 platforms");
  66             System.out.println("Bye! Bye!");
  67             return;
  68         }
  69 
  70         String libPath = System.getProperty("java.library.path");
  71         System.out.println("java.library.path=" + libPath);
  72         String testSrc = System.getProperty("test.src");
  73         System.out.println("test.src=" + testSrc);
  74         String workingDir = System.getProperty("user.dir");
  75         System.out.println("user.dir=" + workingDir);
  76 
  77         String urlCodebase;
  78         if (testSrc.startsWith("/")) {
  79             urlCodebase =
  80                 "file:" + testSrc.replace(File.separatorChar, '/') + "/";
  81         } else {
  82             urlCodebase =
  83                 "file:/" + testSrc.replace(File.separatorChar, '/') + "/";
  84         }
  85 


< prev index next >