云自無心水自閑

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


          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);



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


          網站導航:
           
          主站蜘蛛池模板: 平顶山市| 佛冈县| 和政县| 开封县| 稻城县| 延庆县| 鞍山市| 杂多县| 邹平县| 疏勒县| 安平县| 利川市| 佛学| 台东县| 泗洪县| 达孜县| 北川| 特克斯县| 盐源县| 兴文县| 武胜县| 长沙县| 进贤县| 延庆县| 铁岭市| 洛扎县| 南平市| 长治县| 洪江市| 昌图县| 河池市| 长海县| 洛川县| 宣恩县| 康乐县| 霍州市| 肥东县| 神农架林区| 南皮县| 广饶县| 新安县|