List of usage examples for org.apache.commons.lang3 SystemUtils OS_NAME
String OS_NAME
To view the source code for org.apache.commons.lang3 SystemUtils OS_NAME.
Click Source Link
The os.name System Property.
From source file:com.flowpowered.engine.render.DeployNatives.java
public static void deploy() throws Exception { final String osPath; final String[] nativeLibs; if (SystemUtils.IS_OS_WINDOWS) { nativeLibs = new String[] { "jinput-dx8_64.dll", "jinput-dx8.dll", "jinput-raw_64.dll", "jinput-raw.dll", "jinput-wintab.dll", "lwjgl.dll", "lwjgl64.dll", "OpenAL32.dll", "OpenAL64.dll" }; osPath = "windows/"; } else if (SystemUtils.IS_OS_MAC) { nativeLibs = new String[] { "libjinput-osx.jnilib", "liblwjgl.jnilib", "openal.dylib" }; osPath = "mac/"; } else if (SystemUtils.IS_OS_LINUX) { nativeLibs = new String[] { "liblwjgl.so", "liblwjgl64.so", "libopenal.so", "libopenal64.so", "libjinput-linux.so", "libjinput-linux64.so" }; osPath = "linux/"; } else {/*from w w w .ja v a 2 s .com*/ throw new IllegalStateException("Could not get lwjgl natives for OS \"" + SystemUtils.OS_NAME + "\"."); } final File nativesDir = new File("natives" + File.separator + osPath); nativesDir.mkdirs(); for (String nativeLib : nativeLibs) { final File nativeFile = new File(nativesDir, nativeLib); if (!nativeFile.exists()) { FileUtils.copyInputStreamToFile(DeployNatives.class.getResourceAsStream("/" + nativeLib), nativeFile); } } final String nativesPath = nativesDir.getAbsolutePath(); System.setProperty("org.lwjgl.librarypath", nativesPath); System.setProperty("net.java.games.input.librarypath", nativesPath); }
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 w ww. j av a2 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.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);// ww w . ja v a2 s .co m 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:io.specto.hoverfly.junit.HoverflyRuleUtils.java
static String getOs() { if (SystemUtils.IS_OS_MAC) { return OSX; } else if (SystemUtils.IS_OS_WINDOWS) { return WINDOWS; } else if (SystemUtils.IS_OS_LINUX) { return LINUX; } else {/*from w w w .jav a 2 s. c om*/ throw new UnsupportedOperationException(SystemUtils.OS_NAME + " is not currently supported"); } }
From source file:edu.jhu.jacana.util.PlatformDetection.java
public PlatformDetection() { // resolve OS if (SystemUtils.IS_OS_WINDOWS) { this.os = OS_WINDOWS; } else if (SystemUtils.IS_OS_MAC_OSX) { this.os = OS_OSX; } else if (SystemUtils.IS_OS_SOLARIS) { this.os = OS_SOLARIS; } else if (SystemUtils.IS_OS_LINUX) { this.os = OS_LINUX; } else {//from ww w . ja v a2 s.co m throw new IllegalArgumentException("Unknown operating system " + SystemUtils.OS_NAME); } // resolve architecture Map<String, String> archMap = new HashMap<String, String>(); archMap.put("x86", ARCH_X86_32); archMap.put("i386", ARCH_X86_32); archMap.put("i486", ARCH_X86_32); archMap.put("i586", ARCH_X86_32); archMap.put("i686", ARCH_X86_32); archMap.put("x86_64", ARCH_X86_64); archMap.put("amd64", ARCH_X86_64); archMap.put("powerpc", ARCH_PPC); this.arch = archMap.get(SystemUtils.OS_ARCH); if (this.arch == null) { throw new IllegalArgumentException("Unknown architecture " + SystemUtils.OS_ARCH); } }
From source file:com.netflix.genie.web.tasks.job.JobMonitor.java
/** * Constructor.//from ww w. ja va 2 s . c o m * * @param execution The job execution object including the pid * @param stdOut The std out output file * @param stdErr The std err output file * @param executor The process executor to use * @param publisher The event publisher to use when a job isn't running anymore * @param eventMulticaster The multicaster to send async events * @param registry The metrics event registry * @param jobsProperties The properties for jobs */ public JobMonitor(@Valid final JobExecution execution, @NotNull final File stdOut, @NotNull final File stdErr, @NotNull final Executor executor, @NotNull final ApplicationEventPublisher publisher, @NotNull final ApplicationEventMulticaster eventMulticaster, @NotNull final Registry registry, @NotNull final JobsProperties jobsProperties) { if (!SystemUtils.IS_OS_UNIX) { throw new UnsupportedOperationException("Genie doesn't currently support " + SystemUtils.OS_NAME); } this.errorCount = 0; this.id = execution.getId().orElseThrow(IllegalArgumentException::new); this.execution = execution; this.publisher = publisher; this.eventMulticaster = eventMulticaster; final int processId = execution.getProcessId().orElseThrow(IllegalArgumentException::new); final Date timeout = execution.getTimeout().orElseThrow(IllegalArgumentException::new); this.processChecker = new UnixProcessChecker(processId, executor, timeout); this.stdOut = stdOut; this.stdErr = stdErr; this.maxStdOutLength = jobsProperties.getMax().getStdOutSize(); this.maxStdErrLength = jobsProperties.getMax().getStdErrSize(); this.successfulCheckRate = registry.counter("genie.jobs.successfulStatusCheck.rate"); this.timeoutRate = registry.counter("genie.jobs.timeout.rate"); this.finishedRate = registry.counter("genie.jobs.finished.rate"); this.unsuccessfulCheckRate = registry.counter("genie.jobs.unsuccessfulStatusCheck.rate"); this.stdOutTooLarge = registry.counter("genie.jobs.stdOutTooLarge.rate"); this.stdErrTooLarge = registry.counter("genie.jobs.stdErrTooLarge.rate"); }
From source file:com.simpligility.maven.plugins.android.AndroidNdk.java
public File getStripper(String toolchain) throws MojoExecutionException { final File stripper = findStripper(toolchain); if (stripper == null) { throw new MojoExecutionException("Could not resolve stripper for current OS: " + SystemUtils.OS_NAME); }/*from www . j a v a 2s . c o m*/ // Some basic validation if (!stripper.exists()) { throw new MojoExecutionException("Strip binary " + stripper.getAbsolutePath() + " does not exist, please double check the toolchain and OS used"); } // We should be good to go return stripper; }
From source file:com.opentable.db.postgres.embedded.BundledPostgresBinaryResolver.java
/** * Get current operating system string. The string is used in the appropriate postgres binary * name.//from ww w .ja va 2 s.c om * * @return Current operating system string. */ private static String getOS() { if (SystemUtils.IS_OS_WINDOWS) { return "Windows"; } if (SystemUtils.IS_OS_MAC_OSX) { return "Darwin"; } if (SystemUtils.IS_OS_LINUX) { return "Linux"; } throw new UnsupportedOperationException("Unknown OS " + SystemUtils.OS_NAME); }
From source file:com.norconex.jef4.exec.SystemCommand.java
private String[] getOSCommandPrefixes() { //TODO consider using "nice" on *nix systems. if (SystemUtils.OS_NAME == null) { return EMPTY_STRINGS; }/*from www . ja v a 2s . c om*/ if (SystemUtils.IS_OS_WINDOWS) { if (SystemUtils.IS_OS_WINDOWS_95 || SystemUtils.IS_OS_WINDOWS_98 || SystemUtils.IS_OS_WINDOWS_ME) { return CMD_PREFIXES_WIN_LEGACY; } // NT, 2000, XP and up return CMD_PREFIXES_WIN_CURRENT; } return EMPTY_STRINGS; }
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"; }// w ww. j a v a 2 s .co m version.append("\", family: \"").append(osFamily).append('\"'); return version.toString(); }