gistfile1.txt package cn.huawei.com.CompressedSeacher.util;import java.io.IOException;/** * * * @author l00358914 */public class ExeplorerUtil { private static final ExeplorerUtil instance = new ExeplorerUtil(); private ExeplorerUtil() { }
package cn.huawei.com.CompressedSeacher.util;
import java.io.IOException;
/**
*
*
* @author l00358914
*/
public class ExeplorerUtil {
private static final ExeplorerUtil instance = new ExeplorerUtil();
private ExeplorerUtil() {
}
public static ExeplorerUtil getInstance() {
return instance;
}
public static void execOpenFileLocation(String des) {
if (des == null) {
return;
}
String command = "explorer.exe " + des;
try {
Runtime.getRuntime().exec(command);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* @param path
*/
public static void openJdiskReport() {
String os = System.getProperties().getProperty("os.name");
String command = null;
if (os.contains("windows") || os.contains("Windows")) {
command = "cmd /k start java -Xmx512m -jar external/jdiskreport-1.4.1.jar";
System.out.println("Windows :Invoking " + command);
} else {
System.out.println(System.getProperties().getProperty("user.dir"));
String workpath = System.getProperties().getProperty("user.dir");
StringBuffer sb = new StringBuffer();
sb.append(" java -jar ").append(workpath).append("/external/jdiskreport-1.4.1.jar");
command = sb.toString().trim();
System.out.println("Linux :Invoking " + sb.toString().trim());
}
try {
Runtime.getRuntime().exec(command);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* @param args
*/
public static void main(String[] args) {
// ExeplorerUtil.getInstance().execOpenFileLocation("c:\\");
ExeplorerUtil.getInstance().openJdiskReport();
}
}
