< prev index next >
test/tools/jar/index/MetaInf.java
Print this page
*** 22,51 ****
*/
/*
* @test
* @bug 4408526 6854795
! * @modules jdk.jartool/sun.tools.jar
* @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.zip.ZipFile;
public class MetaInf {
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))
throw new Error("jar failed: args=" + Arrays.toString(args));
}
static void copy(File from, File to) throws IOException {
FileInputStream in = new FileInputStream(from);
--- 22,52 ----
*/
/*
* @test
* @bug 4408526 6854795
! * @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 java.util.spi.ToolProvider;
import java.util.zip.ZipFile;
public class MetaInf {
+ static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar").get();
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 (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 >