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


Java OperatingSystem.getVersion方法代码示例

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


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

示例1: getOperatingSystemInfo

import oshi.software.os.OperatingSystem; //导入方法依赖的package包/类
@Test
public void getOperatingSystemInfo() {
    OshiPlatformCache oshi = newOshiPlatformCache();
    OperatingSystem os = oshi.getOperatingSystem();

    Assert.assertNotNull(os);

    String family = os.getFamily();
    String manu = os.getManufacturer();
    OperatingSystemVersion version = os.getVersion();

    Assert.assertNotNull(family);
    Assert.assertNotNull(manu);
    Assert.assertNotNull(version);

    print("===OPERATION SYSTEM==");
    print("  Family=[%s]", family);
    print("  Manufacturer=[%s]", manu);
    print("  Version=[%s](%s)", version, version.getClass());
    print("  toString=[%s]", os.toString());
}
 
开发者ID:hawkular,项目名称:hawkular-agent,代码行数:22,代码来源:OshiPlatformCacheTest.java

示例2: getSystemParameters

import oshi.software.os.OperatingSystem; //导入方法依赖的package包/类
private static String getSystemParameters() {
    try {
        SystemInfo si = new SystemInfo();
        OperatingSystem os = si.getOperatingSystem();
        HardwareAbstractionLayer hal = si.getHardware();
        int megabyte = 1024 * 1024;


        return "\n==========================System=========================" + "\r\n" +
                "System:" + "\r\n" +
                "\tOS: " + os.getManufacturer() + " " + os.getFamily() + " " +
                os.getVersion() + " x" + getRealSystemArch() + "\r\n" +
                "Hardware:" + "\r\n" +
                "\tProcessors: " + Runtime.getRuntime().availableProcessors() + "\r\n" +
                "\tTotal JVM memory: " + Runtime.getRuntime().maxMemory() / megabyte + " MB " +
                "free:" + Runtime.getRuntime().freeMemory() / megabyte + " MB \r\n" +
                "Java:" + "\r\n" +
                "\tJava version: " + System.getProperty("java.specification.version") + "(" +
                System.getProperty("java.version") + ")" + "\r\n" +
                "\t" + System.getProperty("java.runtime.name") + " v" +
                System.getProperty("java.vm.version") + "\r\n" +
                "=========================================================" + "\r\n";
    } catch (Exception e) {
        log.warn("Could not show system parameters, proceeding", e);
        return "";
    }
}
 
开发者ID:benchdoos,项目名称:WeblocOpener,代码行数:28,代码来源:SystemUtils.java


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