Example usage for org.apache.commons.lang3 SystemUtils OS_VERSION

List of usage examples for org.apache.commons.lang3 SystemUtils OS_VERSION

Introduction

In this page you can find the example usage for org.apache.commons.lang3 SystemUtils OS_VERSION.

Prototype

String OS_VERSION

To view the source code for org.apache.commons.lang3 SystemUtils OS_VERSION.

Click Source Link

Document

The os.version System Property.

Usage

From source file:eu.over9000.skadi.Main.java

private static void printStartupInfo(final String[] args) {
    LOGGER.info("################################################################################");
    LOGGER.info("TIME:    " + LocalDateTime.now().toString());
    LOGGER.info("OS:      " + SystemUtils.OS_NAME + " " + SystemUtils.OS_VERSION + " " + SystemUtils.OS_ARCH);
    LOGGER.info("JAVA:    " + SystemUtils.JAVA_VERSION);
    LOGGER.info(// w w  w  .  ja v a2s .com
            "         " + SystemUtils.JAVA_RUNTIME_NAME + " <build " + SystemUtils.JAVA_RUNTIME_VERSION + ">");
    LOGGER.info("VM:      " + SystemUtils.JAVA_VM_NAME + " <build" + SystemUtils.JAVA_VM_VERSION + ", "
            + SystemUtils.JAVA_VM_INFO + ">");
    LOGGER.info("VM-ARGS: " + ManagementFactory.getRuntimeMXBean().getInputArguments());
    if (VersionRetriever.isLocalInfoAvailable()) {
        LOGGER.info("SKADI:   " + VersionRetriever.getLocalVersion() + " " + VersionRetriever.getLocalBuild()
                + " " + VersionRetriever.getLocalTimestamp());
    } else {
        LOGGER.info("SKADI:   " + "No local version info available");
    }
    LOGGER.info("ARGS:    " + Arrays.asList(args));
    LOGGER.info("################################################################################");
}

From source file:com.o2d.pkayjava.editor.CustomExceptionHandler.java

public static void sendError(String stacktrace) {
    HashMap<String, String> parameters = new HashMap<String, String>();
    parameters.put("error", stacktrace);
    parameters.put("system", SystemUtils.OS_NAME + " " + SystemUtils.OS_VERSION);
    parameters.put("version", AppConfig.getInstance().version);
    HttpRequest httpGet = new HttpRequest(HttpMethods.GET);
    httpGet.setUrl(sendURL);//from   w w  w. j  av  a 2  s .com
    httpGet.setContent(HttpParametersUtils.convertHttpParameters(parameters));
    Gdx.net.sendHttpRequest(httpGet, new HttpResponseListener() {
        public void handleHttpResponse(HttpResponse httpResponse) {
            //showErrorDialog();
        }

        public void failed(Throwable t) {

        }

        @Override
        public void cancelled() {

        }
    });

}

From source file:ch.vorburger.mariadb4j.DBConfigurationBuilder.java

protected String _getDatabaseVersion() {
    String databaseVersion = getDatabaseVersion();
    if (databaseVersion == null) {
        if (OSX.equals(getOS()))
            databaseVersion = "mariadb-10.1.9";
        else if (LINUX.equals(getOS()))
            databaseVersion = "mariadb-10.1.13";
        else if (WIN32.equals(getOS()))
            databaseVersion = "mariadb-10.0.13";
        else//  w  w w.  j  a v  a 2s  .c  om
            throw new IllegalStateException(
                    "OS not directly supported, please use setDatabaseVersion() to set the name "
                            + "of the package that the binaries are in, for: " + SystemUtils.OS_VERSION);
    }
    return databaseVersion;
}

From source file:org.apache.maven.cli.CLIReportingUtils.java

public static String showVersion() {
    final String ls = System.getProperty("line.separator");
    Properties properties = getBuildProperties();
    StringBuilder version = new StringBuilder(256);
    version.append(createMavenVersionString(properties)).append(ls);
    version.append(reduce(properties.getProperty("distributionShortName") + " home: "
            + System.getProperty("maven.home", "<unknown Maven " + "home>"))).append(ls);
    version.append("Java version: ").append(System.getProperty("java.version", "<unknown Java version>"))
            .append(", vendor: ").append(System.getProperty("java.vendor", "<unknown vendor>")).append(ls);
    version.append("Java home: ").append(System.getProperty("java.home", "<unknown Java home>")).append(ls);
    version.append("Default locale: ").append(Locale.getDefault()).append(", platform encoding: ")
            .append(System.getProperty("file.encoding", "<unknown encoding>")).append(ls);
    version.append("OS name: \"").append(SystemUtils.OS_NAME).append("\", version: \"")
            .append(SystemUtils.OS_VERSION).append("\", arch: \"").append(SystemUtils.OS_ARCH);
    String osFamily = "<unknown family>";
    if (SystemUtils.IS_OS_WINDOWS) {
        osFamily = "Windows";
    } else if (SystemUtils.IS_OS_UNIX) {
        osFamily = "Unix";
    }//from  w w  w. j av  a  2s  . c  o  m
    version.append("\", family: \"").append(osFamily).append('\"');
    return version.toString();
}

From source file:org.astrojournal.AJMain.java

/**
 * Main function. By default AstroJournal Main GUI is started. Arguments can
 * be passed. Please see AJMainConsole.printHelp() for options.
 * //from  ww  w.  j  a v a 2 s .  c om
 * @param args
 */
public static void main(String[] args) {
    // Get some information for debugging
    log.debug("Application: " + AJMetaInfo.NAME.getInfo() + " " + AJMetaInfo.VERSION.getInfo());
    log.debug("Operating System: " + SystemUtils.OS_ARCH + " " + SystemUtils.OS_NAME + " "
            + SystemUtils.OS_VERSION);
    log.debug("Java: " + SystemUtils.JAVA_VENDOR + " " + SystemUtils.JAVA_VERSION);

    // Initialise dependency injection with Spring
    ApplicationContext context = new ClassPathXmlApplicationContext("META-INF/aj_spring_default_context.xml");
    BeanFactory factory = context;
    Configuration config = (Configuration) factory.getBean("configuration");
    ConfigurationUtils configUtils = config.getConfigurationUtils();

    try {
        if (args.length == 0) {
            Generator generator = (Generator) factory.getBean("generator");
            startAJMainGUI(generator, config);
        } else if (args[0].equals("-f") || args[0].equals("--config")) {
            log.info(configUtils.printConfiguration(config));
        } else if (args[0].equals("-c") || args[0].equals("--console")) {
            AJMainConsole.main(args);
        } else if (args[0].equals("-h") || args[0].equals("--help")) {
            log.info(AJMainConsole.printHelp());
        } else if (args[0].equals("--license")) {
            log.info(AJMetaInfo.SHORT_LICENSE.getInfo());
        } else if (args[0].equals("-t") || args[0].equals("--test-latex")) {
            log.info(configUtils.printPDFLatexVersion(config));
        } else {
            log.fatal(
                    "Unrecognised option. Please, run AstroJournal with the option -h [--help] for suggestions.");
        }
    } catch (Exception ex) {
        log.error(ex, ex);
    }
}

From source file:org.cryptomator.frontend.webdav.mount.MacOsXAppleScriptWebDavMounter.java

@Override
public boolean shouldWork(Map<MountParam, Optional<String>> mountParams) {
    return SystemUtils.IS_OS_MAC_OSX && semVerComparator.compare(SystemUtils.OS_VERSION, "10.10") >= 0;
}

From source file:org.cryptomator.frontend.webdav.mount.MacOsXShellScriptWebDavMounter.java

@Override
public boolean shouldWork(Map<MountParam, Optional<String>> mountParams) {
    return SystemUtils.IS_OS_MAC_OSX && semVerComparator.compare(SystemUtils.OS_VERSION, "10.10") < 0;
}

From source file:org.cryptomator.ui.Cryptomator.java

public static void main(String[] args) {
    LOG.info("Starting Cryptomator {} on {} {} ({})", ApplicationVersion.orElse("SNAPSHOT"),
            SystemUtils.OS_NAME, SystemUtils.OS_VERSION, SystemUtils.OS_ARCH);

    if (SystemUtils.IS_OS_MAC_OSX) {
        addOsxFileOpenHandler();//from  w w w.ja v a 2 s . co  m
    }

    new CleanShutdownPerformer().registerShutdownHook();

    final Optional<RemoteInstance> runningInstance = SingleInstanceManager
            .getRemoteInstance(MainApplication.APPLICATION_KEY);
    if (runningInstance.isPresent()) {
        sendArgsToRunningInstance(args, runningInstance);
    } else {
        Application.launch(MainApplication.class, args);
    }
}

From source file:org.graylog.plugins.usagestatistics.collectors.NodeCollector.java

private JvmInfo buildJvmSpecs() {
    final JvmStats jvmStats = statsService.jvmStats();
    final JvmInfo.Os os = JvmInfo.Os.create(SystemUtils.OS_NAME, SystemUtils.OS_VERSION, SystemUtils.OS_ARCH);
    final JvmInfo.Memory jvmMemory = JvmInfo.Memory.create(jvmStats.mem().heapInit(), jvmStats.mem().heapMax(),
            jvmStats.mem().nonHeapInit(), jvmStats.mem().nonHeapMax(), jvmStats.mem().directMemoryMax());

    return JvmInfo.create(jvmStats.version(), jvmStats.vmName(), jvmStats.vmVersion(), jvmStats.vmVendor(), os,
            jvmMemory, jvmStats.garbageCollectors());
}

From source file:org.yamj.common.model.YamjInfo.java

@SuppressWarnings("rawtypes")
public YamjInfo(Class myClass) {
    // YAMJ Stuff
    this.projectName = myClass.getPackage().getImplementationVendor();
    this.projectVersion = myClass.getPackage().getImplementationVersion();
    this.moduleName = myClass.getPackage().getImplementationTitle();
    this.moduleDescription = myClass.getPackage().getSpecificationTitle();
    if (myClass.getPackage().getSpecificationVendor() != null) {
        this.buildDateTime = DateTimeTools.parseDate(myClass.getPackage().getSpecificationVendor(),
                DateTimeTools.BUILD_FORMAT);
    } else {//from  w  w w.  ja v a 2 s .com
        this.buildDateTime = new DateTime();
    }
    this.buildRevision = myClass.getPackage().getSpecificationVersion();

    // System Stuff
    this.processorCores = Runtime.getRuntime().availableProcessors();
    this.javaVersion = SystemUtils.JAVA_VERSION;
    this.osArch = SystemUtils.OS_ARCH;
    this.osName = SystemUtils.OS_NAME;
    this.osVersion = SystemUtils.OS_VERSION;

    // Times
    this.startUpDateTime = new DateTime(ManagementFactory.getRuntimeMXBean().getStartTime());

    // Counts
    this.counts = new EnumMap<MetaDataType, Long>(MetaDataType.class);

    // IP Address
    this.coreIp = SystemTools.getIpAddress(Boolean.TRUE);

    // Core Port
    this.corePort = 8888; // TODO: Get this from jetty!

    // Database IP & Name
    findDatabaseInfo();

    this.baseArtworkUrl = buildBaseUrl(PropertyTools.getProperty("yamj3.file.storage.artwork", ""));
    this.baseMediainfoUrl = buildBaseUrl(PropertyTools.getProperty("yamj3.file.storage.mediainfo", ""));
    this.basePhotoUrl = buildBaseUrl(PropertyTools.getProperty("yamj3.file.storage.photo", ""));
    this.skinDir = buildBaseUrl(PropertyTools.getProperty("yamj3.file.storage.skins", "./skins/"));
}