本文整理汇总了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);
}
}
示例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}
};
}
示例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()}
};
}
示例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);
}
}
示例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"));
}
示例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);
}