< prev index next >
jdk/test/tools/jar/index/MetaInf.java
Print this page
@@ -22,30 +22,34 @@
*/
/*
* @test
* @bug 4408526 6854795
- * @modules jdk.jartool/sun.tools.jar
+ * @modules jdk.jartool
* @summary Index the non-meta files in META-INF, such as META-INF/services.
*/
import java.io.*;
import java.util.Arrays;
import java.util.jar.*;
-import sun.tools.jar.Main;
+import java.util.spi.ToolProvider;
import java.util.zip.ZipFile;
public class MetaInf {
+ static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar")
+ .orElseThrow(() ->
+ new RuntimeException("jar tool not found")
+ );
static String jarName = "a.jar";
static String INDEX = "META-INF/INDEX.LIST";
static String SERVICES = "META-INF/services";
static String contents =
System.getProperty("test.src") + File.separatorChar + "jarcontents";
static void run(String ... args) {
- if (! new Main(System.out, System.err, "jar").run(args))
+ if (JAR_TOOL.run(System.out, System.err, args) != 0)
throw new Error("jar failed: args=" + Arrays.toString(args));
}
static void copy(File from, File to) throws IOException {
FileInputStream in = new FileInputStream(from);
< prev index next >