Java
자바에서 다른 프로그램 실행 시키기(shell)
M_막심
2013. 7. 24. 17:44
private void appExe() {
String homePath = System.getProperty("user.home");
String filePath = homePath + "\\" + fileName;
try {
Runtime.getRuntime().exec("rundll32 url.dll, FileProtocolHandler " + filePath);
System.exit(0);
} catch (Exception e) {
e.printStackTrace();
}
}
|
filePath의 확장자에 연결된 프로그램이 실행되게 된다.
ex. filePath = "test.xls"; -> 엑셀 실행