java.util.jar.JarFile#runtimeVersion ( )源码实例Demo

下面列出了java.util.jar.JarFile#runtimeVersion ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Bytecoder   文件: ModuleReferences.java
static JarFile newJarFile(Path path) {
    try {
        return new JarFile(new File(path.toString()),
                           true,                       // verify
                           ZipFile.OPEN_READ,
                           JarFile.runtimeVersion());
    } catch (IOException ioe) {
        throw new UncheckedIOException(ioe);
    }
}
 
源代码2 项目: openjdk-jdk9   文件: ModuleReferences.java
static JarFile newJarFile(Path path) {
    try {
        return new JarFile(new File(path.toString()),
                           true,                       // verify
                           ZipFile.OPEN_READ,
                           JarFile.runtimeVersion());
    } catch (IOException ioe) {
        throw new UncheckedIOException(ioe);
    }
}
 
源代码3 项目: openjdk-jdk9   文件: MultiReleaseJarAPI.java
@DataProvider(name = "versions")
public Object[][] createVersionData() throws Exception {
    return new Object[][]{
            {JarFile.baseVersion(), 8},
            {JarFile.runtimeVersion(), Runtime.version().major()},
            {Runtime.version(), Runtime.version().major()},
            {Runtime.Version.parse("7.1"), JarFile.baseVersion().major()},
            {Runtime.Version.parse("9"), 9},
            {Runtime.Version.parse("9.1.5-ea+200"), 9}
    };
}
 
源代码4 项目: openjdk-jdk9   文件: TestVersionedStream.java
@DataProvider
public Object[][] data() {
    return new Object[][] {
        {Runtime.Version.parse("8")},
        {Runtime.Version.parse("9")},
        {Runtime.Version.parse("10")},
        {Runtime.Version.parse("11")},
        {JarFile.baseVersion()},
        {JarFile.runtimeVersion()}
    };
}
 
源代码5 项目: openjdk-jdk9   文件: MRTestBase.java
protected void checkMultiRelease(String jarFile,
                                 boolean expected) throws IOException {
    try (JarFile jf = new JarFile(new File(jarFile), true,
            ZipFile.OPEN_READ, JarFile.runtimeVersion())) {
        assertEquals(jf.isMultiRelease(), expected);
    }
}
 
源代码6 项目: openjdk-jdk9   文件: Basic.java
@Test
public void testCustomManifest() throws Throwable {
    String jarfile = "test.jar";

    compile("test01");

    Path classes = Paths.get("classes");
    Path manifest = Paths.get("Manifest.txt");

    // create
    Files.write(manifest, "Class-Path: MyUtils.jar\n".getBytes());

    jar("cfm", jarfile, manifest.toString(),
            "-C", classes.resolve("base").toString(), ".",
            "--release", "10", "-C", classes.resolve("v10").toString(), ".")
            .shouldHaveExitValue(SUCCESS)
            .shouldBeEmpty();

    try (JarFile jf = new JarFile(new File(jarfile), true,
            ZipFile.OPEN_READ, JarFile.runtimeVersion())) {
        assertTrue(jf.isMultiRelease(), "Not multi-release jar");
        assertEquals(jf.getManifest()
                        .getMainAttributes()
                        .getValue("Class-Path"),
                "MyUtils.jar");
    }

    // update
    Files.write(manifest, "Multi-release: false\n".getBytes());

    jar("ufm", jarfile, manifest.toString(),
            "-C", classes.resolve("base").toString(), ".",
            "--release", "9", "-C", classes.resolve("v10").toString(), ".")
            .shouldHaveExitValue(SUCCESS)
            .shouldContain("WARNING: Duplicate name in Manifest: Multi-release.");

    try (JarFile jf = new JarFile(new File(jarfile), true,
            ZipFile.OPEN_READ, JarFile.runtimeVersion())) {
        assertTrue(jf.isMultiRelease(), "Not multi-release jar");
        assertEquals(jf.getManifest()
                        .getMainAttributes()
                        .getValue("Class-Path"),
                "MyUtils.jar");
    }

    FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile));
    FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes"));
}
 
源代码7 项目: Bytecoder   文件: ModulePath.java
/**
 * Returns a ModuleFinder that locates modules on the file system by
 * searching a sequence of directories and/or packaged modules. The modules
 * may be patched by the given ModulePatcher.
 */
public static ModuleFinder of(ModulePatcher patcher, Path... entries) {
    return new ModulePath(JarFile.runtimeVersion(), false, patcher, entries);
}
 
源代码8 项目: openjdk-jdk9   文件: ModulePath.java
/**
 * Returns a ModuleFinder that that locates modules on the file system by
 * searching a sequence of directories and/or packaged modules. The modules
 * may be patched by the given ModulePatcher.
 */
public static ModuleFinder of(ModulePatcher patcher, Path... entries) {
    return new ModulePath(JarFile.runtimeVersion(), false, patcher, entries);
}