public class Manifests extends Object
| 构造器和说明 |
|---|
Manifests() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
getClassVersion(Class<?> klass)
Attempts to return the version of the jar/module for the given class.
|
static Manifest |
getManifest(Class<?> klass) |
static Manifest |
loadManifest() |
static Manifest |
loadManifest(String jarPath) |
public static Manifest loadManifest()
public static String getClassVersion(Class<?> klass)
Attempts to return the version of the jar/module for the given class.
First, retrieves the Implementation-Version main attribute of the manifest;
if that is missing, retrieves the JPMS module version (via reflection);
if that is missing, returns an empty Optional.
klass - the class of the jar/module to retrieve the versionCopyright © 2020. All rights reserved.