import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URI;
import javax.swing.JButton;
import javax.swing.JFrame;
public class OpenURLDemo {
public OpenURLDemo() {
JFrame frame = new JFrame();
JButton btn = new JButton();
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
new Thread() {
public void run() {
String cmd = "cmd.exe /c start ";
String file = "http://zhidao.baidu.com";
try {
Runtime.getRuntime().exec(cmd + file);
} catch (IOException ignore) {
}
}
}.start();
}
});
frame.getContentPane().add(btn);
frame.setAlwaysOnTop(true);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setSize(100, 100);
frame.setVisible(true);
}
public static void main(String[] args) {
new OpenURLDemo();
}
}
在一并笑个JSP里面写一个超链绝拍含接 百度