JAVA에서 파일 오픈하기 (윈도우)
Program/Java 2009/06/29 10:43JAVA에서 exe 파일을 실행하기 위해서는 Runtime.getRuntime().exec("파일 주소"); 과 같이 실행하면 되지만
파일을 실행하기위해서는 조금 변경을 해야된다. 왜냐하면 어떤 파일과 연동이되서 실행을 시켜야되는 정보를 java에서 알지를 못하니깐 말이다...
File f = new File(item.desc);
if(f.exists()){
try{
Process fileExec =
fileExec = Runtime.getRuntime().
exec("rundll32.exe shell32.dll,ShellExec_RunDLL \""+f.toString()+"\"");
fileExec.waitFor();
}catch(IOException ie){
System.out.println("첨부파일열기 실행오류 :"+ie.toString());
}catch(InterruptedException ire){
System.out.println("첨부파일열기 실행오류2 :"+ire.toString());
}
}else{
}
