< prev index next >

test/java/nio/channels/AsynchronousChannelGroup/SetupJar.java

Print this page

        

@@ -19,16 +19,21 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
+import java.io.File;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.stream.Stream;
 
 public class SetupJar {
-
     public static void main(String args[]) throws Exception {
-        Path classes = Paths.get(System.getProperty("test.classes", ""));
-        JarUtils.createJarFile(Paths.get("privileged.jar"),
-                               classes.resolve("bootlib"));
+        String cp = System.getProperty("test.class.path");
+        Path bootlib = Stream.of(cp.split(File.pathSeparator))
+                .map(Paths::get)
+                .filter(e -> e.endsWith("bootlib"))  // file name
+                .findAny()
+                .orElseThrow(() -> new InternalError("bootlib not found"));
+        JarUtils.createJarFile(Paths.get("privileged.jar"), bootlib);
     }
 }
< prev index next >