请教一下:怎么用java调用IE来打开html文档? 不用IE你用JCreator Pro也可以的,后者还可以自动生成html文件的。很方便的。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 提示一下两种方法调DOS命令 p.exec使用SWING组件 Process process = Runtime.getRuntime().exec("cmd.exe /c start http://www.csdn.net"); 如果是本地html文件:try{Process process = Runtime.getRuntime().exec("cmd.exe /c start Noname.html");}catch(Exception e){e.printStackTrace();} Applet?还是Application? foryouever(光速兔子) :说的是可行的。我已经会了。谢谢各位。下面是我的一些代码:public class IEExecuter implements HyperLinkExecutable{ jet.util.TempFile tempFile = new jet.util.TempFile("","~url","url"); public String execute(java.awt.Component comp, String displayValue, String url) { if(url == null || url.length() == 0) return null; Runtime runtime; String filename; runtime = Runtime.getRuntime(); try{ if ( jet.util.SystemTools.isWinNT ) // check Windows NT serial in the future { File f = tempFile.createTempFile(); FileOutputStream fout = new FileOutputStream(f); PrintWriter dout = new PrintWriter(fout); dout.println("[InternetShortcut]"); dout.println("URL=" + url); dout.println("Modified=F0DB6E5C9293BE0179"); dout.close(); fout.close(); Process p = runtime.exec("cmd /c start " + f.getAbsolutePath()); p.waitFor(); synchronized(this) { try{ wait(3000); }catch(Exception e){ } } f.delete(); } else { runtime.exec("start " + url); } } catch(Exception e) { JDebug.WARNING(e); return e.getMessage(); } return null; }} 求帮帮忙,看看这段代码出现什么问题???? 程序被强制退出(如结束进程)怎样处理退出事件? jtable 编辑了之后如何保存? 再问个正则表达式问题 如何读取EXCEL中的内容 关于java实现MP3的播放? weblogic6无法启动. java 静态和非静态的一点疑问 高手来解答下!!! 请教Java8中接口里定义默认方法和静态方法出错的问题 刚刚写了一个单纯形算法,请大家帮忙优化! 100分求java2类库电子版,中文英文都可以!
使用SWING组件
try{
Process process = Runtime.getRuntime().exec("cmd.exe /c start Noname.html");
}catch(Exception e){e.printStackTrace();}
?
还是
Application
?
谢谢各位。
下面是我的一些代码:
public class IEExecuter implements HyperLinkExecutable
{
jet.util.TempFile tempFile = new jet.util.TempFile("","~url","url");
public String execute(java.awt.Component comp, String displayValue, String url)
{
if(url == null || url.length() == 0)
return null; Runtime runtime;
String filename; runtime = Runtime.getRuntime();
try{
if ( jet.util.SystemTools.isWinNT ) // check Windows NT serial in the future
{
File f = tempFile.createTempFile();
FileOutputStream fout = new FileOutputStream(f);
PrintWriter dout = new PrintWriter(fout);
dout.println("[InternetShortcut]");
dout.println("URL=" + url);
dout.println("Modified=F0DB6E5C9293BE0179");
dout.close();
fout.close();
Process p = runtime.exec("cmd /c start " + f.getAbsolutePath());
p.waitFor();
synchronized(this)
{
try{
wait(3000);
}catch(Exception e){
}
}
f.delete();
}
else
{
runtime.exec("start " + url);
}
}
catch(Exception e)
{
JDebug.WARNING(e);
return e.getMessage();
}
return null;
}
}