当前位置: 首页>>代码示例>>Java>>正文


Java JarFile.runtimeVersion方法代码示例

本文整理汇总了Java中java.util.jar.JarFile.runtimeVersion方法的典型用法代码示例。如果您正苦于以下问题:Java JarFile.runtimeVersion方法的具体用法?Java JarFile.runtimeVersion怎么用?Java JarFile.runtimeVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.jar.JarFile的用法示例。


在下文中一共展示了JarFile.runtimeVersion方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newJarFile

import java.util.jar.JarFile; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:ModuleReferences.java

示例2: createVersionData

import java.util.jar.JarFile; //导入方法依赖的package包/类
@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}
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:MultiReleaseJarAPI.java

示例3: data

import java.util.jar.JarFile; //导入方法依赖的package包/类
@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()}
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TestVersionedStream.java

示例4: checkMultiRelease

import java.util.jar.JarFile; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:MRTestBase.java

示例5: testCustomManifest

import java.util.jar.JarFile; //导入方法依赖的package包/类
@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"));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:49,代码来源:Basic.java

示例6: of

import java.util.jar.JarFile; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:ModulePath.java


注:本文中的java.util.jar.JarFile.runtimeVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。