티스토리 뷰

	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"; -> 엑셀 실행


댓글