本文整理匯總了Java中org.apache.commons.lang3.SystemUtils.IS_OS_UNIX屬性的典型用法代碼示例。如果您正苦於以下問題:Java SystemUtils.IS_OS_UNIX屬性的具體用法?Java SystemUtils.IS_OS_UNIX怎麽用?Java SystemUtils.IS_OS_UNIX使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.commons.lang3.SystemUtils
的用法示例。
在下文中一共展示了SystemUtils.IS_OS_UNIX屬性的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deleteRecursively
/**
* Delete a file or directory and its contents recursively.
* Don't follow directories if they are symlinks.
*
* @param file Input file / dir to be deleted
* @throws IOException if deletion is unsuccessful
*/
public static void deleteRecursively(File file) throws IOException {
if (file == null) { return; }
// On Unix systems, use operating system command to run faster
// If that does not work out, fallback to the Java IO way
if (SystemUtils.IS_OS_UNIX) {
try {
deleteRecursivelyUsingUnixNative(file);
return;
} catch (IOException e) {
logger.warn("Attempt to delete using native Unix OS command failed for path = {}. " +
"Falling back to Java IO way", file.getAbsolutePath(), e);
}
}
deleteRecursivelyUsingJavaIO(file);
}
示例2: initControlPanel
private void initControlPanel(Config config) {
portField.setTextFormatter(new TextFormatter<>(change -> {
change.setText(change.getText().replaceAll("[^0-9.,]", ""));
return change;
}));
if (SystemUtils.IS_OS_UNIX) {
// change web-cache dir
// from: $HOME/.com.gitlab.anlar.lunatic.gui.LunaticApplication/webview
// to: $HOME/.cache/lunatic-smtp/webview/
this.emailText.getEngine().setUserDataDirectory(new File(
SystemUtils.USER_HOME + File.separator + ".cache" + File.separator + "lunatic-smtp",
"webview"));
}
portField.setText(String.valueOf(config.getPort()));
messagesField.setText("0");
setStartButtonText(false);
dirField.setText(config.getDirectory());
saveDirCheck.setSelected(config.isWrite());
}
示例3: 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;
}
示例4: browse
/**
* Opens a browser for the given {@code URI}. It is supposed to avoid issues with KDE systems.
*
* @param uri URI to browse
*/
public static void browse(URI uri)
{
try
{
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE))
{
Desktop.getDesktop().browse(uri);
return;
}
else if (SystemUtils.IS_OS_UNIX && (new File("/usr/bin/xdg-open").exists() || new File("/usr/local/bin/xdg-open").exists()))
{
new ProcessBuilder("xdg-open", uri.toString()).start();
return;
}
throw new UnsupportedOperationException("Your operating system does not support launching browser from Net2Plan");
}
catch (IOException | UnsupportedOperationException e)
{
throw new RuntimeException(e);
}
}
示例5: 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);
}
}
}
示例6: 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");
}
}
示例7: findPathToDefaultBinaryInJar
private static String findPathToDefaultBinaryInJar() throws IOException {
boolean isOsSupported = SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_UNIX;
checkArgument(isOsSupported, "Unsupported operating system");
if (SystemHelper.isWindows()) {
return PATH_TO_BINARY_IN_JAR_WINDOWS;
} else if (SystemHelper.isRedhat()) {
return PATH_TO_BINARY_IN_JAR_UNIX_REDHAT;
} else if (SystemHelper.isLinux()) {
return PATH_TO_BINARY_IN_JAR_UNIX;
}
throw new IllegalStateException("Non compatible operating system for " + TARGET_BINARY_NAME);
}
示例8: fillOS
private static String fillOS(){
String os = null;
if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) os = "mac";
else if (SystemUtils.IS_OS_UNIX) os = "linux";
else if (SystemUtils.IS_OS_WINDOWS) os = "windows";
return os;
}
示例9: check
@Override
public boolean check(Event e) {
Boolean chk = false;
switch (ty) {
case (0):
chk = SystemUtils.IS_OS_WINDOWS;
break;
case (1):
chk = SystemUtils.IS_OS_MAC;
break;
case (2):
chk = SystemUtils.IS_OS_LINUX;
break;
case (3):
chk = SystemUtils.IS_OS_UNIX;
break;
case (4):
chk = SystemUtils.IS_OS_SOLARIS;
break;
case (5):
chk = SystemUtils.IS_OS_SUN_OS;
break;
case (6):
chk = SystemUtils.IS_OS_HP_UX;
break;
case (7):
chk = SystemUtils.IS_OS_AIX;
break;
case (8):
chk = SystemUtils.IS_OS_IRIX;
break;
case (9):
chk = SystemUtils.IS_OS_FREE_BSD;
break;
case (10):
chk = SystemUtils.IS_OS_OPEN_BSD;
break;
case (11):
chk = SystemUtils.IS_OS_NET_BSD;
break;
}
return (isNegated() ? !chk : chk);
}