java里调用windows程序代码,比如 notepad 记事本 等
- import java.io.IOException;
- public class Open {
- public static void open(String fileName) throws IOException
- {
- Runtime r = Runtime.getRuntime();
- Process p = null;
- try
- {
- p = Runtime.getRuntime().exec("cmd /c start "+fileName);
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- }
- }