학습자료/Java
[java] 파일 실행
cozyboy
2015. 1. 8. 17:39
button2를 눌렀을때 chc_conf.txt 이란 메모장을 열기
ActionListener openConfig = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
Runtime rt = Runtime.getRuntime();
String exeFile = "C://Windows//System32//notepad.exe C://chc_conf.txt";
Process p;
try {
p = rt.exec(exeFile);
p.waitFor();
} catch (Exception ee) {
ee.printStackTrace();
}
}
};
button2.addActionListener(printAction);