< prev index next >

test/jdk/java/lang/System/SecurityManagerWarnings.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -26,11 +26,10 @@
   * @bug 8266459 8268349 8269543 8270380
   * @summary check various warnings
   * @library /test/lib
   */
  
- import jdk.test.lib.JDKToolFinder;
  import jdk.test.lib.process.OutputAnalyzer;
  import jdk.test.lib.process.ProcessTools;
  import jdk.test.lib.util.JarUtils;
  
  import java.io.ByteArrayOutputStream;

@@ -49,10 +48,11 @@
                          permission java.lang.RuntimePermission "createSecurityManager";
                          permission java.lang.RuntimePermission "setSecurityManager";
                      };
                      """);
  
+             System.setProperty("test.noclasspath", "true");
              String testClasses = System.getProperty("test.classes");
  
              disallowTest(null, testClasses);
              allowTest("allow", testClasses);
              disallowTest("disallow", testClasses);

@@ -129,17 +129,15 @@
      }
  
      static OutputAnalyzer run(String prop, String cp) throws Exception {
          ProcessBuilder pb;
          if (prop == null) {
-             pb = new ProcessBuilder(
-                     JDKToolFinder.getJDKTool("java"),
+             pb = ProcessTools.createTestJavaProcessBuilder(
                      "-cp", cp,
                      "SecurityManagerWarnings", "run");
          } else {
-             pb = new ProcessBuilder(
-                     JDKToolFinder.getJDKTool("java"),
+             pb = ProcessTools.createTestJavaProcessBuilder(
                      "-cp", cp,
                      "-Djava.security.manager=" + prop,
                      "-Djava.security.policy=policy",
                      "SecurityManagerWarnings", "run");
          }
< prev index next >