本文整理匯總了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;
}
示例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());
}
}
示例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());
}
示例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());
}
示例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("未知操作係統.");
}
}
示例6: isEnabled
@Override
public boolean isEnabled() {
if (!SystemUtils.IS_OS_LINUX) {
return false;
}
String projectName = EnvUtil.getProjectCode();
return StringUtils.isNotEmpty(projectName);
}
示例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();
}
示例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;
}
示例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();
}
示例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));
}
}
示例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 + ".");
}
}
示例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;
}
示例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);
}
}
示例14: IsLinux
@Override
public boolean IsLinux() {
return SystemUtils.IS_OS_LINUX;
}
示例15: isLinux
public static boolean isLinux() {
return SystemUtils.IS_OS_LINUX;
}