云自無心水自閑

          天平山上白云泉,云自無心水自閑。何必奔沖山下去,更添波浪向人間!
          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)站導航:
           
          主站蜘蛛池模板: 克东县| 忻州市| 若尔盖县| 阿合奇县| 高平市| 庐江县| 石楼县| 万山特区| 格尔木市| 鹤峰县| 育儿| 宜都市| 时尚| 子洲县| 全南县| 尼木县| 泰来县| 光泽县| 綦江县| 浪卡子县| 绥化市| 丹棱县| 宝鸡市| 雅安市| 年辖:市辖区| 奉化市| 海丰县| 新乡市| 六安市| 科技| 财经| 万山特区| 咸丰县| 德清县| 甘德县| 长寿区| 故城县| 上林县| 河曲县| 成武县| 二手房|