本文整理匯總了Java中java.lang.management.RuntimeMXBean.getSpecVersion方法的典型用法代碼示例。如果您正苦於以下問題:Java RuntimeMXBean.getSpecVersion方法的具體用法?Java RuntimeMXBean.getSpecVersion怎麽用?Java RuntimeMXBean.getSpecVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.lang.management.RuntimeMXBean
的用法示例。
在下文中一共展示了RuntimeMXBean.getSpecVersion方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getJvmVersion
import java.lang.management.RuntimeMXBean; //導入方法依賴的package包/類
/**
* Gets the version of the JVM in the form "VM_Name - Vendor - Spec/Version".
*
* @return The JVM version.
*/
public static String getJvmVersion() {
try {
final RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean();
return bean.getVmName() + " - " + bean.getVmVendor() + " - " + bean.getSpecVersion() + '/' + bean.getVmVersion();
}
catch (Throwable t) {
return UNKNOWN;
}
}
示例2: findCurrentJvm
import java.lang.management.RuntimeMXBean; //導入方法依賴的package包/類
JavaVirtualMachine findCurrentJvm()
throws JavaVirtualMachine.UnsupportedJavaVirtualMachineException {
final RuntimeMXBean runtimeBean = getRuntimeMxBean();
final String specVendor = runtimeBean.getSpecVendor();
final String specVersion = runtimeBean.getSpecVersion();
final String vmVendor = runtimeBean.getVmVendor();
final String vmVersion = runtimeBean.getVmVersion();
logger.debug("JVM spec vendor: '%s'; spec version: '%s'; vm vendor: '%s'; vm version: '%s'",
specVendor, specVersion, vmVendor, vmVersion);
return JavaVirtualMachine.Supported.find(vmVendor, specVersion);
}