本文整理匯總了Java中org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS屬性的典型用法代碼示例。如果您正苦於以下問題:Java SystemUtils.IS_OS_WINDOWS屬性的具體用法?Java SystemUtils.IS_OS_WINDOWS怎麽用?Java SystemUtils.IS_OS_WINDOWS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.commons.lang3.SystemUtils
的用法示例。
在下文中一共展示了SystemUtils.IS_OS_WINDOWS屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doStart
private void doStart() {
try {
String[] command;
if (SystemUtils.IS_OS_WINDOWS) {
// for windows test
command = new String[] { "C:/Program Files/Java/jdk1.8.0_91/bin/java", "-version" };
} else {
// real use
Assert.notNull(file);
command = new String[] { this.command, argf, calculateFileName() };
}
process = new ProcessBuilder(command).redirectErrorStream(true).start();
BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = null;
while ((line = input.readLine()) != null) {
content.add(String.format("%s : %s", name, line));
this.checkForEviction();
}
int exitVal = process.waitFor();
log.info("Exited with error code " + exitVal);
} catch (Exception e) {
log.error("Error", e);
throw new RuntimeException(e);
}
}
示例2: setOnScrollListener
/**
* Enables handling of scroll and mouse wheel events for the node.
* This type of events has a peculiarity on Windows. See the javadoc of notifyScrollEvents for more information.
* @see #notifyScrollEvent
* @param intersectionTestFunc a function that takes an event object and must return boolean
* @return itself to let you use a chain of calls
*/
MouseEventNotificator setOnScrollListener(Function<NativeMouseWheelEvent, Boolean> intersectionTestFunc) {
if (SystemUtils.IS_OS_WINDOWS) {
if (!GlobalScreen.isNativeHookRegistered()) {
try {
GlobalScreen.registerNativeHook();
} catch (NativeHookException | UnsatisfiedLinkError e) {
e.printStackTrace();
Main.log("Failed to initialize the native hooking. Rolling back to using JavaFX events...");
sender.addEventFilter(ScrollEvent.SCROLL, this::notifyScrollEvent);
return this;
}
}
mouseWheelListener = event -> notifyScrollEvent(event, intersectionTestFunc);
GlobalScreen.addNativeMouseWheelListener(mouseWheelListener);
} else {
sender.addEventFilter(ScrollEvent.SCROLL, this::notifyScrollEvent);
}
return this;
}
示例3: getSensor
public static Sensor getSensor() {
if (SystemUtils.IS_OS_WINDOWS) {
return new WindowsSensor();
} else if (SystemUtils.IS_OS_LINUX) {
return new LMSensor();
} else {
System.err.println(SystemUtils.OS_NAME + " is not a supported operating system.");
return new Sensor() {
@Override
public void poll() throws IOException {
temperatures.put("Fake 0", 0d);
temperatures.put("Fake 100", 100d);
}
};
}
}
示例4: initializeDefaultPreferences
public void initializeDefaultPreferences() {
IPreferenceStore store = IDEUtil.getPreferences().getPreferenceStore();
EGradleCallType defaultCallType = null;
if (SystemUtils.IS_OS_WINDOWS){
defaultCallType = EGradleCallType.WINDOWS_GRADLE_WRAPPER;
}else{
defaultCallType = EGradleCallType.LINUX_GRADLE_WRAPPER;
}
store.setDefault(P_OUTPUT_VALIDATION_ENABLED.getId(), true);
store.setDefault(P_FILEHANDLING_AUTOMATICALLY_DERIVE_BUILDFOLDERS.getId(), false);
store.setDefault(P_IMPORT__EXECUTE_ASSEMBLE_TASK.getId(), true);
store.setDefault(P_IMPORT__DO_CLEAN_PROJECTS.getId(),true);
store.setDefault(P_SHOW_CONSOLE_VIEW_ON_BUILD_FAILED_ENABLED.getId(), true);
store.setDefault(P_DECORATION_SUBPROJECTS_WITH_ICON_ENABLED.getId(), true);
store.setDefault(P_GRADLE_CALL_TYPE.getId(),defaultCallType.getId());
store.setDefault(P_GRADLE_SHELL.getId(), defaultCallType.getDefaultShell().getId());
store.setDefault(P_GRADLE_INSTALL_BIN_FOLDER.getId(), defaultCallType.getDefaultGradleBinFolder());
store.setDefault(P_GRADLE_CALL_COMMAND.getId(), defaultCallType.getDefaultGradleCommand());
store.setDefault(P_MIGRATE_IDE_STATE.getId(), MigrationState.NOT_MIGRATED.name());
}
示例5: getConfigBasePathForAll
/**
* 獲得全平台的基礎路徑<br>
* 真正的跨平台!
* @author Administrator
* @return
*/
public static String getConfigBasePathForAll()
{
String ret = "";
//根據操作係統決定真正的配置路徑
if (SystemUtils.IS_OS_WINDOWS)
{
ret = FileKit.getMyConfigBasePathForWindows();
}
else if (SystemUtils.IS_OS_LINUX)
{
ret = CONFIG_BASEPATH_LINUX;
}
else if (SystemUtils.IS_OS_MAC)
{
ret = CONFIG_BASEPATH_MAC;
}
else
{
//其他情況下,都是類Unix的係統,因此均采用Linux的路徑設置
ret = CONFIG_BASEPATH_LINUX;
}
return ret;
}
示例6: testResolveInWindowsOS
@Test
public void testResolveInWindowsOS() throws Exception {
if (!SystemUtils.IS_OS_WINDOWS) {
// Skip tests
return;
}
assertEquals(
toResourceIdentifier("C:\\my home\\out put"),
toResourceIdentifier("C:\\my home\\")
.resolve("out put", StandardResolveOptions.RESOLVE_FILE));
assertEquals(
toResourceIdentifier("C:\\out put"),
toResourceIdentifier("C:\\my home\\")
.resolve("..", StandardResolveOptions.RESOLVE_DIRECTORY)
.resolve(".", StandardResolveOptions.RESOLVE_DIRECTORY)
.resolve("out put", StandardResolveOptions.RESOLVE_FILE));
assertEquals(
toResourceIdentifier("C:\\my home\\**\\*"),
toResourceIdentifier("C:\\my home\\")
.resolve("**", StandardResolveOptions.RESOLVE_DIRECTORY)
.resolve("*", StandardResolveOptions.RESOLVE_FILE));
}
示例7: buildCmd
private List<String> buildCmd() {
List<String> cmd = new ArrayList<>();
File logicbin = null;
if(SystemUtils.IS_OS_WINDOWS) {
logicbin = LogicRunMain.LOGIC_BIN_WIN;
} else if(SystemUtils.IS_OS_UNIX) {
logicbin = LogicRunMain.LOGIC_BIN_UNIX;
}
if(logicbin == null) {
logger.error("Unsupported operating system");
return null;
}
cmd.add(logicbin.getAbsolutePath());
addGeneralParams(cmd);
addAdvancedParams(cmd);
addDebugParams(cmd);
cmd.add(params.getTextValue(TextParam.GFile));
return cmd;
}
示例8: initLocalLpSolve
private static void initLocalLpSolve() throws Exception {
// Find or create the jopt-lib-lpsolve directory in temp
File lpSolveTempDir = NativeUtils.createTempDir("jopt-lib-lpsolve");
lpSolveTempDir.deleteOnExit();
// Add this directory to the java library path
NativeUtils.addLibraryPath(lpSolveTempDir.getAbsolutePath());
// Add the right files to this directory
if (SystemUtils.IS_OS_WINDOWS) {
if (SystemUtils.OS_ARCH.contains("64")) {
NativeUtils.loadLibraryFromJar("/lib/64_lpsolve55.dll", lpSolveTempDir);
NativeUtils.loadLibraryFromJar("/lib/64_lpsolve55j.dll", lpSolveTempDir);
} else {
NativeUtils.loadLibraryFromJar("/lib/32_lpsolve55.dll", lpSolveTempDir);
NativeUtils.loadLibraryFromJar("/lib/32_lpsolve55j.dll", lpSolveTempDir);
}
} else if (SystemUtils.IS_OS_UNIX) {
if (SystemUtils.OS_ARCH.contains("64")) {
NativeUtils.loadLibraryFromJar("/lib/64_liblpsolve55.so", lpSolveTempDir);
NativeUtils.loadLibraryFromJar("/lib/64_liblpsolve55j.so", lpSolveTempDir);
} else {
NativeUtils.loadLibraryFromJar("/lib/32_liblpsolve55.so", lpSolveTempDir);
NativeUtils.loadLibraryFromJar("/lib/32_liblpsolve55j.so", lpSolveTempDir);
}
}
}
示例9: getOwnJavaPath
private static String getOwnJavaPath() {
String extension = "";
if (SystemUtils.IS_OS_WINDOWS) {
extension = ".exe";
}
return System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"
+ extension;
}
示例10: getLocalCommandExecutor
private static LocalCommandExecutor getLocalCommandExecutor() {
if (SystemUtils.IS_OS_WINDOWS) {
return new WindowsLocalCommandExecutor();
} else if (SystemUtils.IS_OS_UNIX) {
return new UnixLocalCommandExecutor();
} else {
throw new UnsupportedOperationException("OS not supported for local execution");
}
}
示例11: createMmapFile
public static MapDbAppStorage createMmapFile(String fileSystemName, File dbFile) {
return new MapDbAppStorage(fileSystemName, () -> {
DBMaker.Maker maker = DBMaker.fileDB(dbFile)
.transactionEnable();
// it is not recommanded to use mmap on Windows (crash)
// http://www.mapdb.org/blog/mmap_files_alloc_and_jvm_crash/
if (!SystemUtils.IS_OS_WINDOWS) {
maker.fileMmapEnableIfSupported()
.fileMmapPreclearDisable();
}
return maker.make();
});
}
示例12: getAppHomeDir
private static Path getAppHomeDir() {
String base = SystemUtils.USER_HOME;
if (StringUtils.isBlank(base)) {
// For WINDOWS
if (SystemUtils.IS_OS_WINDOWS) {
// try to set APPDATA
base = System.getenv("APPDATA");
// try to set SYSTEMDRIVE
if (StringUtils.isBlank(base)) {
base = System.getenv("SYSTEMDRIVE");
base = StringUtils.isNotBlank(base) ? base + "\\" : null;
}
// try to set C disk
if (StringUtils.isBlank(base)) {
base = "C:\\";
}
} else {
// no strict check for other OS file system - just use Unix like file path
base = "/opt";
}
}
return Paths.get(base, "xm-online");
}
示例13: getLocalModFolder
public static String getLocalModFolder() {
if(SystemUtils.IS_OS_LINUX) {
return SystemUtils.getUserHome().toPath().resolve(".local/share/Colossal Order/Cities_Skylines/Addons/Mods").toString();
}
else if(SystemUtils.IS_OS_WINDOWS) {
String dataFolder = System.getenv("LOCALAPPDATA");
return Paths.get(dataFolder).resolve("Colossal Order\\Cities_Skylines\\Addons\\Mods").toString();
}
else if(SystemUtils.IS_OS_MAC_OSX) {
return SystemUtils.getUserHome().toPath().resolve("Library/Application Support/Colossal Order/Cities_Skylines/Addons/Mods").toString();
}
else {
return "";
}
}
示例14: getExecutableExtension
private static String getExecutableExtension(final boolean forRegex) {
if (SystemUtils.IS_OS_WINDOWS) {
final String exe = ".exe";
if (forRegex) {
return "\\" + exe;
}
return exe;
}
return "";
}
示例15: isSerialPort
private boolean isSerialPort(SerialPort sp) {
String portName = sp.getSystemPortName().toLowerCase();
String portDesc = sp.getDescriptivePortName().toLowerCase();
return (SystemUtils.IS_OS_MAC_OSX && portName.startsWith("cu") && portName.contains("usbserial") ||
SystemUtils.IS_OS_MAC_OSX && portName.startsWith("cu.hc-0") || // Bluetooth uart on Mac
SystemUtils.IS_OS_WINDOWS && portDesc.contains("serial") ||
SystemUtils.IS_OS_WINDOWS && portDesc.contains("hc-0") || // Bluetooth uart on Win
SystemUtils.IS_OS_LINUX && portDesc.contains("usb") && portDesc.contains("serial") ||
SystemUtils.IS_OS_LINUX && portDesc.contains("hc-0") || // Bluetooth uart on Linux?
portDesc.contains("pmsensor") // TODO make the name configurable (custom name for BT HC-05/HC-06 or even normal serial)
);
}