List of usage examples for java.lang System getProperty
public static String getProperty(String key)
From source file:Main.java
public static String getDirectory(String path) { String osName = System.getProperty("os.name"); // test(osName); if (osName.contains("Win")) { path = path.substring(0, path.lastIndexOf('\\') + 1); } else {// w w w .jav a 2 s.co m path = path.substring(0, path.lastIndexOf('/') + 1); } return path; }
From source file:OSUtils.java
public static final boolean isLinux() { return System.getProperty("os.name").equals("Linux"); }
From source file:Main.java
public static File getCurrentDirectory() { return new File(System.getProperty("user.dir")); }
From source file:Main.java
public static String getOSName() { return System.getProperty("os.name").toLowerCase(); }
From source file:Main.java
public static boolean isWindows() { return System.getProperty("os.name").startsWith("Windows"); }
From source file:Main.java
public static String getAppPath() { String curDir = System.getProperty("user.dir"); return curDir; }
From source file:Main.java
public static String removeExtension(String s) { String separator = System.getProperty("file.separator"); String filename;/*from w ww. j av a 2 s . co m*/ // Remove the path up to the filename. int lastSeparatorIndex = s.lastIndexOf(separator); if (lastSeparatorIndex == -1) { filename = s; } else { filename = s.substring(lastSeparatorIndex + 1); } // Remove the extension. int extensionIndex = filename.lastIndexOf("."); if (extensionIndex == -1) return filename; return filename.substring(0, extensionIndex); }
From source file:Main.java
/** * @return//from w w w . ja va 2 s.c o m */ public static String getDataSourceFileName() { String userDir = System.getProperty("user.dir"); String fileName = userDir + "\\datasource.xml"; return fileName; }
From source file:Main.java
public static File tempDir() { return new File(System.getProperty("java.io.tmpdir")); }
From source file:Main.java
public final static int getArchitecture() { return Integer.parseInt(System.getProperty("sun.arch.data.model")); }