jdk/test/tools/jmod/JmodNegativeTest.java
changeset 41484 834b7539ada3
parent 40261 86a49ba76f52
child 42468 7a9555a7e080
--- a/jdk/test/tools/jmod/JmodNegativeTest.java	Wed Oct 12 14:31:17 2016 -0700
+++ b/jdk/test/tools/jmod/JmodNegativeTest.java	Wed Oct 12 15:41:00 2016 -0700
@@ -24,8 +24,8 @@
 /*
  * @test
  * @library /lib/testlibrary
- * @modules jdk.jlink/jdk.tools.jmod
- *          jdk.compiler
+ * @modules jdk.compiler
+ *          jdk.jlink
  * @build jdk.testlibrary.FileUtils CompilerUtils
  * @run testng JmodNegativeTest
  * @summary Negative tests for jmod
@@ -39,6 +39,7 @@
 import java.util.List;
 import java.util.function.Consumer;
 import java.util.function.Supplier;
+import java.util.spi.ToolProvider;
 import java.util.zip.ZipOutputStream;
 import jdk.testlibrary.FileUtils;
 import org.testng.annotations.BeforeTest;
@@ -51,6 +52,11 @@
 
 public class JmodNegativeTest {
 
+    static final ToolProvider JMOD_TOOL = ToolProvider.findFirst("jmod")
+        .orElseThrow(() ->
+            new RuntimeException("jmod tool not found")
+        );
+
     static final String TEST_SRC = System.getProperty("test.src", ".");
     static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
     static final Path EXPLODED_DIR = Paths.get("build");
@@ -515,7 +521,7 @@
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         PrintStream ps = new PrintStream(baos);
         System.out.println("jmod " + Arrays.asList(args));
-        int ec = jdk.tools.jmod.Main.run(args, ps);
+        int ec = JMOD_TOOL.run(ps, ps, args);
         return new JmodResult(ec, new String(baos.toByteArray(), UTF_8));
     }