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


Java SystemUtils.IS_OS_WINDOWS属性代码示例

本文整理汇总了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);
	}
}
 
开发者ID:XinYang-Pan,项目名称:LogMonitor,代码行数:25,代码来源:LogMonitorSimple.java

示例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;
}
 
开发者ID:DeskChan,项目名称:DeskChan,代码行数:27,代码来源:MouseEventNotificator.java

示例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);
			}
		};
	}
}
 
开发者ID:Tankernn,项目名称:JavaGridControl,代码行数:17,代码来源:SensorFactory.java

示例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());
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:25,代码来源:EGradleIdePreferenceInitializer.java

示例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;
}
 
开发者ID:lnwazg,项目名称:kit,代码行数:29,代码来源:FileKit.java

示例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));
}
 
开发者ID:apache,项目名称:beam,代码行数:24,代码来源:LocalResourceIdTest.java

示例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;
}
 
开发者ID:hpiasg,项目名称:asglogic,代码行数:22,代码来源:LogicRunner.java

示例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);
        }
    }
}
 
开发者ID:blubin,项目名称:JOpt,代码行数:27,代码来源:LPSolveMIPSolver.java

示例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;
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:8,代码来源:WelcomeWizard.java

示例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");
    }
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:9,代码来源:LocalComputationManager.java

示例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();
    });
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:13,代码来源:MapDbAppStorage.java

示例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");
}
 
开发者ID:xm-online,项目名称:xm-commons,代码行数:27,代码来源:FileSystemUtils.java

示例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 "";
    }
}
 
开发者ID:rumangerst,项目名称:CSLMusicModStationCreator,代码行数:15,代码来源:CitiesHelper.java

示例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 "";
}
 
开发者ID:klaushauschild1984,项目名称:selenium-toys,代码行数:10,代码来源:ChromeWebDriverFactory.java

示例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)
    );
}
 
开发者ID:rjaros87,项目名称:pm-home-station,代码行数:12,代码来源:SerialUART.java


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