如何用java 调用一个应用软件 我现在用Swing写了一个GUI 然后上面有一个按钮 当我点击这个按钮的时候就打开一个我指定的程序 跟360软件小助手的这个差不多 我想问的是如何得到这个我要打开的程序 路径 然后给ActionLister这个事件 当我点击按钮的时候就调用这个路径的程序 我该怎么写 以前从来没写过 想写着玩下 求高手指教谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Process proc = Runtime.getRuntime().exec("notepad.exe");打开记事本; Process proc = Runtime.getRuntime().exec("D:/Program Files/PPStream/PPStream.exe"); 打开本机上的PPS; public static void main(String[] args) { JFrame frame = new JFrame("打开程序"); FlowLayout flowLayout = new FlowLayout(FlowLayout.CENTER); flowLayout.setHgap(20); flowLayout.setVgap(20); JButton buttonComfirm = new JButton("打开酷狗"); buttonComfirm.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { Runtime.getRuntime() .exec("E:\\Program Files\\YouKu\\iKu\\iKuPlayer.exe"); } catch (Exception ex) { ex.printStackTrace(); } } }); frame.add(buttonComfirm); frame.setBounds(0, 0, 300, 300); frame.setVisible(true); frame.setResizable(false); } swing中JTextArea的问题 Eclipse工程中无法加载图片 代码有问题,高手请进 = : 这个符号的作用是什么 大家进来帮帮忙啊 请教一个如何求ArrayList中的VO的某三个属性相同的个数 一个奇怪的问题:为什么应用程序关闭后还有javaw.exe? 求一道例题的解题思路 怪事情啊,快来看看哦!! 跳楼求救!!那位大哥有JET的序列号?急啊!!!!!!!!1 java中random随机数 输出以下图形.其中图形的大小由用户输入来决定。
打开记事本;
打开本机上的PPS;
JFrame frame = new JFrame("打开程序");
FlowLayout flowLayout = new FlowLayout(FlowLayout.CENTER);
flowLayout.setHgap(20);
flowLayout.setVgap(20); JButton buttonComfirm = new JButton("打开酷狗");
buttonComfirm.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
Runtime.getRuntime()
.exec("E:\\Program Files\\YouKu\\iKu\\iKuPlayer.exe");
} catch (Exception ex) {
ex.printStackTrace();
}
}
}); frame.add(buttonComfirm);
frame.setBounds(0, 0, 300, 300);
frame.setVisible(true);
frame.setResizable(false);
}