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

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

Introduction

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

Prototype

String JAVA_RUNTIME_VERSION

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

Click Source Link

Document

The java.runtime.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(/*from   www.  jav a 2 s. c  o  m*/
            "         " + 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.google.code.jconfig.ConfigurationManager.java

private ConfigurationManager(Map<String, IConfigurationChangeListener> listeners, String filepath) {
    logger.debug("Running on machine with Java version: " + SystemUtils.JAVA_RUNTIME_VERSION);
    if (!SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5)) {
        logger.fatal("Current Java version: " + SystemUtils.JAVA_RUNTIME_VERSION + " - NEEDED "
                + JavaVersion.JAVA_1_5 + " or above.");
        throw new RuntimeException("You must have at leat Java 1.5 using this library.");
    }//from  w  ww.j  a va2 s  . c  o m

    logger.info("******* ConfigurationManager initialization *******");
    logger.info(" -> configuration: " + filepath);
    logger.info(" -> registered listeners: " + listeners);
    logger.info("***************************************************");

    this.filepath = filepath;
    activeListeners = listeners;
    currentConfigurationInfo = new ConfigurationInfo();
}

From source file:jp.co.iidev.subartifact1.divider1.mojo.ArtifactDividerMojo.java

public void execute() throws MojoExecutionException {

    Artifact projArt = project.getArtifact();
    Map<Dependency, Artifact> artifactsForDep = Maps.newHashMap();

    projArt = project.getArtifact();//from w w  w.j a  va2 s .  c om

    {
        List<Dependency> dep = project.getDependencies();
        Set<Artifact> arts = project.getDependencyArtifacts();

        for (Dependency dx : dep) {
            String grpid = dx.getGroupId();
            String artid = dx.getArtifactId();
            String clsf = dx.getClassifier();

            for (Artifact art : arts) {
                boolean a = StringUtils.equals(art.getArtifactId(), artid);
                boolean g = StringUtils.equals(art.getGroupId(), grpid);
                boolean c = StringUtils.equals(art.getClassifier(), clsf);

                if (a && g && c) {
                    artifactsForDep.put(dx, art);
                }
            }
        }
    }

    {
        String version = project.getVersion();
        String groupId = project.getGroupId();

        LinkedHashMap<File, Dependency> compiletimeClasspath = Maps.newLinkedHashMap();

        File rtjar = Paths.get(System.getProperty("java.home"), "lib", "rt.jar").toFile();
        Dependency rtjar_dummyDep = new Dependency();
        {
            rtjar_dummyDep.setGroupId(SystemUtils.JAVA_VENDOR.replace(" ", "."));
            rtjar_dummyDep.setVersion(SystemUtils.JAVA_RUNTIME_VERSION);
            rtjar_dummyDep.setArtifactId(SystemUtils.JAVA_RUNTIME_NAME);
        }

        File targetJar = project.getArtifact().getFile();
        Dependency targetJarDep = new Dependency();
        {
            targetJarDep.setArtifactId(project.getArtifactId());
            targetJarDep.setGroupId(project.getGroupId());
            targetJarDep.setVersion(project.getVersion());
            targetJarDep.setClassifier(projArt.getClassifier());
        }

        compiletimeClasspath.put(rtjar, rtjar_dummyDep);
        compiletimeClasspath.put(targetJar, targetJarDep);
        artifactsForDep.forEach((d, a) -> {
            compiletimeClasspath.put(a.getFile(), d);
        });

        LoggableFactory lf = new LoggableFactory() {
            @Override
            public Loggable createLoggable(Class cx) {
                return new Loggable() {
                    Logger l = LoggerFactory.getLogger(cx);

                    @Override
                    public void warn(String text) {
                        l.warn(text);
                    }

                    @Override
                    public void info(String text) {
                        l.info(text);
                    }

                    @Override
                    public void error(String text) {
                        l.error(text);
                    }

                    @Override
                    public void debug(String text) {
                        l.debug(text);
                    }
                };
            }
        };
        try {
            LinkedHashMap<SubArtifactDefinition, SubArtifactDeployment> buildPlan = new DivisionExecutor(
                    lf.createLoggable(DivisionExecutor.class)).planDivision(targetJar, rootSubArtifactId,
                            Arrays.asList(subartifacts == null ? new SubArtifact[0] : subartifacts),
                            compiletimeClasspath, not(in(ImmutableSet.of(rtjar, targetJar))),
                            defaultRootTransitivePropagations, defaultRootSourceReferencePropagations,
                            defaultSubartifactSourceReferencePropagations, globalReferencePropagations, lf);

            Set<File> usableJar = Sets.newLinkedHashSet(compiletimeClasspath.keySet());
            usableJar.remove(targetJar);
            usableJar.remove(rtjar);

            int ix = 0;
            for (SubArtifact s : subartifacts) {
                for (Dependency d : s.getExtraDependencies()) {
                    buildPlan.get(s).getJarDeps().put(new File("x_xx_xyx_duMmy" + (ix++) + ".jar"), d);
                }
            }

            new PomSetGenerator(project.getBasedir().toPath().resolve("pom.xml"), outputDirectory.toPath(),
                    templateOutputDirectory.toPath(), lf).generate(groupId, version,
                            this.subArtifactsParentArtifactId, buildPlan);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new MojoExecutionException("division process error", e);
        }
    }

}

From source file:org.eclipse.epp.internal.logging.aeri.ui.model.Reports.java

public static ErrorReport newErrorReport(IStatus event, Settings settings, ServerConfiguration configuration) {
    ErrorReport mReport = factory.createErrorReport();
    mReport.setAnonymousId(AnonymousId.getId());
    mReport.setName(settings.getName());
    mReport.setEmail(settings.getEmail());

    mReport.setJavaRuntimeVersion(SystemUtils.JAVA_RUNTIME_VERSION);
    mReport.setEclipseBuildId(getEclipseBuildId().or("-"));
    mReport.setEclipseProduct(System.getProperty("eclipse.product", "-"));
    mReport.setOsgiArch(System.getProperty("osgi.arch", "-"));
    mReport.setOsgiWs(System.getProperty("osgi.ws", "-"));
    mReport.setOsgiOs(System.getProperty(org.osgi.framework.Constants.FRAMEWORK_OS_NAME, "-"));
    mReport.setOsgiOsVersion(System.getProperty(org.osgi.framework.Constants.FRAMEWORK_OS_VERSION, "-"));
    mReport.setStatus(newStatus(event, configuration));

    return mReport;
}