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


Java SystemUtils.IS_OS_LINUX属性代码示例

本文整理汇总了Java中org.apache.commons.lang.SystemUtils.IS_OS_LINUX属性的典型用法代码示例。如果您正苦于以下问题:Java SystemUtils.IS_OS_LINUX属性的具体用法?Java SystemUtils.IS_OS_LINUX怎么用?Java SystemUtils.IS_OS_LINUX使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.lang.SystemUtils的用法示例。


在下文中一共展示了SystemUtils.IS_OS_LINUX属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPhantomLocation

/**
 * The location of the phantom js is different for different os types. The
 * method returns the appropriate binary corresponding to the os. Currently
 * only Windows, Mac OS and Linux are supported.
 *
 * @return The location of the phantom js
 */
private static String getPhantomLocation() {
    String phantomLocation;
    String reportDirectory = ExportUtils.getReportDirectory() + File.separator;
    if (SystemUtils.IS_OS_WINDOWS) {
        phantomLocation = reportDirectory + "windows_phantomjs.exe";
    } else if (SystemUtils.IS_OS_MAC) {
        phantomLocation = reportDirectory + "macosx_phantomjs";
    } else if (SystemUtils.IS_OS_LINUX) {
        phantomLocation = reportDirectory + "linux_phantomjs";
    } else {
        logger.error("phantomLocation is null. Check phantomjs binary is present or not");
        throw new EfwException("PhantomJs Location is null. Can't process request.");
    }

    File file = new File(phantomLocation);
    phantomLocation = file.getAbsolutePath();
    return phantomLocation;
}
 
开发者ID:helicalinsight,项目名称:helicalinsight,代码行数:25,代码来源:ReportsProcessor.java

示例2: initializeLibraryPath

public static void initializeLibraryPath() throws Exception {
    File theJava3DFile = new File("java3d");
    File theJava3DLibraryFile = null;
    if (SystemUtils.IS_OS_WINDOWS) {
        if (VM_32_BIT) {
            theJava3DLibraryFile =  new File(theJava3DFile, "win32");
        } else {
            theJava3DLibraryFile =  new File(theJava3DFile, "win64");
        }
    }
    if (SystemUtils.IS_OS_LINUX) {
        if (VM_32_BIT) {
            theJava3DLibraryFile =  new File(theJava3DFile, "linux32");
        } else {
            theJava3DLibraryFile =  new File(theJava3DFile, "linux64");
        }
    }
    if (SystemUtils.IS_OS_MAC) {
        theJava3DLibraryFile =  new File(theJava3DFile, "macos-universal");
    }
    if (theJava3DLibraryFile != null) {
        addLibraryPath(theJava3DLibraryFile.getAbsolutePath());
    }
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:24,代码来源:Java3DUtils.java

示例3: testMakeFileForPath

@Test
public void testMakeFileForPath() throws Exception {
  assertNull(ModelUtils.makeFileForPath(null));
  assertNull(ModelUtils.makeFileForPath(""));

  assertEquals(new File((File) null, "/some/who/files/2012-11-02 13.47.10.jpg").getCanonicalPath(), ModelUtils.makeFileForPath("file:///some/who/files/2012-11-02 13.47.10.jpg").getAbsolutePath());
  assertEquals(new File((File) null, "/some/who/files/2012-11-02 13.47.10.jpg").getCanonicalPath(), ModelUtils.makeFileForPath("file:///some/who/files/2012-11-02%2013.47.10.jpg").getAbsolutePath());
  assertEquals(new File((File) null, "/some/who/files/main.c++").getCanonicalPath(), ModelUtils.makeFileForPath("file:///some/who/files/main.c++").getAbsolutePath());

  assertEquals(new File((File) null, "/some/folder/temp/").getCanonicalPath(), ModelUtils.makeFileForPath("file:///some/folder/temp/").getAbsolutePath());

  if (SystemUtils.IS_OS_LINUX) {
    assertEquals(new File((File) null, "/some/folder/temp/ :<>?").getCanonicalPath(), ModelUtils.makeFileForPath("file:///some/folder/temp/ :<>?").getAbsolutePath());
    assertEquals(new File((File) null, "/some/folder&ssd/temp/ :<>?test=jks&lls=1").getCanonicalPath(), ModelUtils.makeFileForPath("file:///some/folder&ssd/temp/ :<>?test=jks&lls=1").getAbsolutePath());
  }
  assertEquals("src/main/java/com/igormaznitsa/nbmindmap/nb/QuickSearchProvider.java".replace('/', File.separatorChar), ModelUtils.makeFileForPath("src/main/java/com/igormaznitsa/nbmindmap/nb/QuickSearchProvider.java").getPath());
}
 
开发者ID:raydac,项目名称:netbeans-mmd-plugin,代码行数:17,代码来源:ModelUtilsTest.java

示例4: execute

/**
 * Execute the shell script.
 * 
 * @param args
 *            The arguments.
 * @throws IOException
 *             If an error occurs.
 * @throws InterruptedException
 *             If an error occurs.
 */
protected ExecutionResult execute(String... args) throws IOException, InterruptedException {
    assumeTrue("Test cannot be executed on this operating system.", SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_LINUX);
    String jqaHhome = new File(properties.getProperty("jqassistant.home")).getAbsolutePath();
    List<String> command = new ArrayList<>();
    if (SystemUtils.IS_OS_WINDOWS) {
        command.add("cmd.exe");
        command.add("/C");
        command.add(jqaHhome + "\\bin\\jqassistant.cmd");
    } else if (SystemUtils.IS_OS_LINUX) {
        command.add(jqaHhome + "/bin/jqassistant.sh");
    }
    command.addAll(Arrays.asList(args));

    ProcessBuilder builder = new ProcessBuilder(command);
    Map<String, String> environment = builder.environment();
    environment.put("JQASSISTANT_HOME", jqaHhome);
    // environment.put("JQASSISTANT_OPTS", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000");

    File workingDirectory = getWorkingDirectory();
    builder.directory(workingDirectory);

    final Process process = builder.start();

    ConsoleReader standardConsole = new ConsoleReader(process.getInputStream(), System.out);
    ConsoleReader errorConsole = new ConsoleReader(process.getErrorStream(), System.err);
    Executors.newCachedThreadPool().submit(standardConsole);
    Executors.newCachedThreadPool().submit(errorConsole);
    int exitCode = process.waitFor();
    return new ExecutionResult(exitCode, standardConsole.getOutput(), errorConsole.getOutput());
}
 
开发者ID:buschmais,项目名称:jqa-commandline-tool,代码行数:40,代码来源:AbstractCLIIT.java

示例5: getServerIpNoCache

private static String getServerIpNoCache() {
	if (SystemUtils.IS_OS_WINDOWS) {
		return "127.0.0.1";
	}
	else if (SystemUtils.IS_OS_MAC) {
		return "127.0.0.1";
	}
	else if (SystemUtils.IS_OS_LINUX) {
		try {
			NetworkInterface networkInterface = NetworkInterface.getByName("eth0");
			if (networkInterface == null) {
				networkInterface = NetworkInterface.getByName("eth1");
				if (networkInterface == null) {
					throw new NullPointerException("网卡eth0和eth1都找不到,没办法获取到IP.");
				}
			}
			return getServerIp(networkInterface);
		}
		catch (SocketException e) {
			throw new RuntimeException(e.getMessage(), e);
		}
	}
	else {
		throw new RuntimeException("未知操作系统.");
	}

}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:27,代码来源:ServerIpUtil.java

示例6: isEnabled

@Override
public boolean isEnabled() {
	if (!SystemUtils.IS_OS_LINUX) {
		return false;
	}
	String projectName = EnvUtil.getProjectCode();
	return StringUtils.isNotEmpty(projectName);
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:8,代码来源:EnvLeiServerImpl.java

示例7: isEnabled

@Override
public boolean isEnabled() {
	if (!SystemUtils.IS_OS_LINUX) {
		return false;
	}
	String dir = "/data/jenkins/";
	File file = new File(dir);
	return file.exists();
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:9,代码来源:EnvLeiHudsonImpl.java

示例8: isDisable

protected boolean isDisable() {
	if (SystemUtils.IS_OS_WINDOWS) {
		return false;
	}
	if (SystemUtils.IS_OS_LINUX) {
		String env = System.getenv("ENV");
		String jettyHome = System.getenv("JETTY_HOME");
		if (StringUtils.isNotEmpty(env) && StringUtils.isNotEmpty(jettyHome)) {
			return true;
		}
	}
	return false;
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:13,代码来源:PropertyConfigurator.java

示例9: LibraryLoader

public LibraryLoader() {
	tmpdir = System.getProperty("java.io.tmpdir");
	fLibsFolder = "OCR";
	vSysArch = System.getProperty("sikuli.arch");
    if (null == vSysArch) {
      vSysArch = System.getProperty("os.arch");
    }
    
    if (vSysArch.contains("64")) {
    	vSysArch = "x86"; 
    } else {
    	vSysArch = "x86";
    }
    
	if (SystemUtils.IS_OS_WINDOWS) {
		neededLibs = new String[] {"libtesseract-3.dll", "jnitesseract.dll"};
		os = "windows";
	} else if (SystemUtils.IS_OS_MAC) {
		neededLibs = new String[] {"libtesseract.3.dylib", "libjnitesseract.dylib"};
		os = "macosx";
	} else if (SystemUtils.IS_OS_LINUX) {
		neededLibs = new String[] {"libtesseract.so.3", "libjnitesseract.so"};
		os = "linux";
	}
	
	this.extractDllFromJar();
}
 
开发者ID:Hi-Fi,项目名称:remotesikulilibrary,代码行数:27,代码来源:LibraryLoader.java

示例10: testAsURI_Linux_CreatedAsFile

@Test
public void testAsURI_Linux_CreatedAsFile() throws Exception {
  if (SystemUtils.IS_OS_LINUX) {
    final Properties props = new Properties();
    props.put("Kõik või", "tere");

    final MMapURI uri = new MMapURI(null, new File("/Kõik/või/mitte/midagi.txt"), props);
    assertEquals(new URI("file:///K%C3%B5ik/v%C3%B5i/mitte/midagi.txt?K%C3%B5ik+v%C3%B5i=tere"), uri.asURI());
    assertEquals("tere", uri.getParameters().getProperty("Kõik või"));
    assertEquals(new File("/Kõik/või/mitte/midagi.txt"), uri.asFile(null));
  }
}
 
开发者ID:raydac,项目名称:netbeans-mmd-plugin,代码行数:12,代码来源:MMapURITest.java

示例11: performLoading

private static void performLoading(String customLibPath, String userSpecifiedBLAS) {
	// Only Linux supported for BLAS
	if(!SystemUtils.IS_OS_LINUX)
		return;

	// attemptedLoading variable ensures that we don't try to load SystemML and other dependencies 
	// again and again especially in the parfor (hence the double-checking with synchronized).
	if(shouldReload(customLibPath) && isSupportedBLAS(userSpecifiedBLAS) && isSupportedArchitecture()) {
		long start = System.nanoTime();
		synchronized(NativeHelper.class) {
			if(shouldReload(customLibPath)) {
				// Set attempted loading unsuccessful in case of exception
				CURRENT_NATIVE_BLAS_STATE = NativeBlasState.ATTEMPTED_LOADING_NATIVE_BLAS_UNSUCCESSFULLY;
				String [] blas = new String[] { userSpecifiedBLAS }; 
				if(userSpecifiedBLAS.equalsIgnoreCase("auto")) {
					blas = new String[] { "mkl", "openblas" };
				}
				if(checkAndLoadBLAS(customLibPath, blas) && loadLibraryHelper("libsystemml_" + blasType + "-Linux-x86_64.so")) {
					LOG.info("Using native blas: " + blasType + getNativeBLASPath());
					CURRENT_NATIVE_BLAS_STATE = NativeBlasState.SUCCESSFULLY_LOADED_NATIVE_BLAS_AND_IN_USE;
				}
			}
		}
		double timeToLoadInMilliseconds = (System.nanoTime()-start)*1e-6;
		if(timeToLoadInMilliseconds > 1000) 
			LOG.warn("Time to load native blas: " + timeToLoadInMilliseconds + " milliseconds.");
	}
	else if(LOG.isDebugEnabled() && !isSupportedBLAS(userSpecifiedBLAS)) {
		LOG.debug("Using internal Java BLAS as native BLAS support the configuration 'sysml.native.blas'=" + userSpecifiedBLAS + ".");
	}
}
 
开发者ID:apache,项目名称:systemml,代码行数:31,代码来源:NativeHelper.java

示例12: isApplicable

@Override
protected boolean isApplicable() {
    final boolean nettyDoesSupportMacUnixSockets = SystemUtils.IS_OS_MAC_OSX &&
            ComparableVersion.OS_VERSION.isGreaterThanOrEqualTo("10.12");

    return SystemUtils.IS_OS_LINUX || nettyDoesSupportMacUnixSockets;
}
 
开发者ID:testcontainers,项目名称:testcontainers-java,代码行数:7,代码来源:UnixSocketClientProviderStrategy.java

示例13: PlatformDetection

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 {
    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);
  }
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:29,代码来源:PlatformDetection.java

示例14: IsLinux

@Override
public boolean IsLinux() {
    return SystemUtils.IS_OS_LINUX;
}
 
开发者ID:secana,项目名称:Jenkins-Cakebuild,代码行数:4,代码来源:OSChecker.java

示例15: isLinux

public static boolean isLinux() {
	return SystemUtils.IS_OS_LINUX;
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:3,代码来源:SystemUtil.java


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