一、获取当前操作系统类型:System.getProperty("os.name")
不同的操作系统执行不同命令:
windows执行命令:license_windows.exe(当前目录下)
linux执行命令:./lib/license_linux(指定目录下)
// 所执行的命令
String cmds = "";
// 获取操作系统的输出结果
String os = System.getProperty("os.name");
if (os != null && os.toLowerCase().startsWith("windows")) {
// Windows操作系统
// 获取文件相对地址
File f = new File("license_windows.exe");
cmds = f.getAbsolutePath();
} else if (os != null && os.toLowerCase().startsWith("linux")) {
// Linux操作系统
cmds = "./lib/license_linux";
}
InputStream fis = null;
InputStreamReader isr = null;
BufferedReader br = null;
System.out.println("命令: