我在程序中得到一些列url,想要调用默认浏览器打开它,如何写?多谢

解决方案 »

  1.   

    Runtime.exec(command)
    ms-dos里面可以运行的命令,上面的也就可以运行了.
    比如Runtime.getRuntime().exec("iexplore http://localhost");
      

  2.   

    怎么用javascript写?我是swing写得界面?
      

  3.   

    Runtime.exec(command)
    ms-dos里面可以运行的命令,上面的也就可以运行了.
    比如Runtime.getRuntime().exec("iexplore http://localhost");我是想调用默认浏览器。这个只是调用ie呀。
      

  4.   

    public class InvokeCMD{
      public static void main(String args[]){
      
       try{
       Runtime.getRuntime().exec("iexplore http://localhost");
            }catch(java.io.IOException e){}
       }
       }
    上面代码执行后怎么不能打开IE阿?请指教
      

  5.   

    js里边打开..好像是document.execommand("iexplore http://localhost")
      

  6.   

    我现在是不能用js打开,因为我是一个应用程序,怎么去调用js呢。上面的runtime方法我也试了,打不开ie窗口。
      

  7.   

    用java恐怕不容易实现,用vc写一个本地方法吧,然后再用jni调用。
      

  8.   

    哈哈,找到了String cmd="rundll32 url.dll FileProtocolHandler http://www.csdn.net";Runtime.getRuntime.exec(cmd);
      

  9.   

    得这样写能打开 ie :Runtime.getRuntime().exec("C:/Program Files/Internet Explorer/iexplore.exe http://localhost");