< prev index next >

test/tools/lib/tests/JImageGenerator.java

Print this page

        

@@ -336,10 +336,12 @@
             throw new AssertionError("Module check failed.");
         }
     }
 
     public static class JModTask {
+        static final java.util.spi.ToolProvider JMOD_TOOL =
+            java.util.spi.ToolProvider.findFirst("jmod").get();
 
         private final List<Path> classpath = new ArrayList<>();
         private final List<Path> libs = new ArrayList<>();
         private final List<Path> cmds = new ArrayList<>();
         private final List<Path> config = new ArrayList<>();

@@ -475,11 +477,12 @@
 
         private Result cmd(String cmd) {
             String[] args = optionsJMod(cmd);
             System.err.println("jmod options: " + optionsPrettyPrint(args));
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            int exitCode = jdk.tools.jmod.Main.run(args, new PrintStream(baos));
+            PrintStream ps = new PrintStream(baos);
+            int exitCode = JMOD_TOOL.run(ps, ps, args);
             String msg = new String(baos.toByteArray());
             return new Result(exitCode, msg, output);
         }
     }
 

@@ -554,10 +557,12 @@
             return cmd("extract", dir);
         }
     }
 
     public static class JLinkTask {
+        static final java.util.spi.ToolProvider JLINK_TOOL =
+            java.util.spi.ToolProvider.findFirst("jlink").get();
 
         private final List<Path> jars = new ArrayList<>();
         private final List<Path> jmods = new ArrayList<>();
         private final List<Path> pluginModulePath = new ArrayList<>();
         private final List<String> addMods = new ArrayList<>();

@@ -689,19 +694,21 @@
 
         public Result call() {
             String[] args = optionsJLink();
             System.err.println("jlink options: " + optionsPrettyPrint(args));
             StringWriter writer = new StringWriter();
-            int exitCode = jdk.tools.jlink.internal.Main.run(args, new PrintWriter(writer));
+            PrintWriter pw = new PrintWriter(writer);
+            int exitCode = JLINK_TOOL.run(pw, pw, args);
             return new Result(exitCode, writer.toString(), output);
         }
 
         public Result callPostProcess() {
             String[] args = optionsPostProcessJLink();
             System.err.println("jlink options: " + optionsPrettyPrint(args));
             StringWriter writer = new StringWriter();
-            int exitCode = jdk.tools.jlink.internal.Main.run(args, new PrintWriter(writer));
+            PrintWriter pw = new PrintWriter(writer);
+            int exitCode = JLINK_TOOL.run(pw, pw, args);
             return new Result(exitCode, writer.toString(), output);
         }
     }
 
     public static class InMemorySourceFile {
< prev index next >