云自無心水自閑

          天平山上白云泉,云自無心水自閑。何必奔沖山下去,更添波浪向人間!
          posts - 288, comments - 524, trackbacks - 0, articles - 6
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理


          java.awt.Desktop is the class you're looking for.

          import java.awt.Desktop; 
          import java.net.URI;
          // ...
          if(Desktop.isDesktopSupported()) {
          Desktop.getDesktop().browse(new URI("http://www.example.com"));
          }


          If you're using Java 6 or above, see the Desktop API, in particular browse. Use it like this (not tested):

          // using this in real life, you'd probably want to check that the desktop
          // methods are supported using isDesktopSupported()...
          
          String htmlFilePath = "path/to/html/file.html"; // path to your new file
          File htmlFile = new File(htmlFilePath);
          
          // open the default web browser for the HTML page
          Desktop.getDesktop().browse(htmlFile.toURI());
          
          // if a web browser is the default HTML handler, this might work too
          Desktop.getDesktop().open(htmlFile);



          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 西城区| 大同市| 始兴县| 金阳县| 临潭县| 和田市| 民乐县| 青阳县| 屏边| 淄博市| 乌兰浩特市| 易门县| 沭阳县| 青铜峡市| 无为县| 微山县| 高台县| 宜兰县| 宝应县| 安康市| 呼伦贝尔市| 金川县| 老河口市| 满洲里市| 长沙县| 黄山市| 仁化县| 安阳市| 保德县| 修水县| 安庆市| 北安市| 台中市| 舟曲县| 临颍县| 常宁市| 环江| 封开县| 元江| 菏泽市| 灵寿县|