--- a/jdk/test/tools/jar/JarBackSlash.java Wed Oct 12 14:31:17 2016 -0700
+++ b/jdk/test/tools/jar/JarBackSlash.java Wed Oct 12 15:41:00 2016 -0700
@@ -28,7 +28,7 @@
/*
* @test
* @bug 7201156
- * @modules jdk.jartool/sun.tools.jar
+ * @modules jdk.jartool
* @summary jar tool fails to convert file separation characters for list and extract
* @author Sean Chou
*/
@@ -43,10 +43,13 @@
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
-
-import sun.tools.jar.Main;
+import java.util.spi.ToolProvider;
public class JarBackSlash {
+ private static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar")
+ .orElseThrow(() ->
+ new RuntimeException("jar tool not found")
+ );
// used construct an entry JarBackSlash/dir/file.txt
private static String JARBACKSLASH = "JarBackSlash";
@@ -78,8 +81,8 @@
PipedInputStream pipedInput = new PipedInputStream(pipedOutput);
PrintStream out = new PrintStream(pipedOutput);
- Main jarTool = new Main(out, System.err, "jar");
- if (!jarTool.run(jarArgs)) {
+ int rc = JAR_TOOL.run(out, System.err, jarArgs);
+ if (rc != 0) {
fail("Could not list jar file.");
}
@@ -101,8 +104,8 @@
PipedInputStream pipedInput = new PipedInputStream(pipedOutput);
PrintStream out = new PrintStream(pipedOutput);
- Main jarTool = new Main(out, System.err, "jar");
- if (!jarTool.run(jarArgs)) {
+ int rc = JAR_TOOL.run(out, System.err, jarArgs);
+ if (rc != 0) {
fail("Could not list jar file.");
}