云自無心水自閑

          天平山上白云泉,云自無心水自閑。何必奔沖山下去,更添波浪向人間!
          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);



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


          網站導航:
           
          主站蜘蛛池模板: 藁城市| 韩城市| 格尔木市| 昭通市| 台南市| 周至县| 文登市| 六枝特区| 信丰县| 元氏县| 珲春市| 施甸县| 棋牌| 沁水县| 云和县| 麻城市| 资阳市| 榕江县| 天门市| 亳州市| 东宁县| 东光县| 轮台县| 米脂县| 钟山县| 陆河县| 新巴尔虎右旗| 龙江县| 师宗县| 姜堰市| 平谷区| 云龙县| 胶州市| 大荔县| 二连浩特市| 赞皇县| 铁力市| 青浦区| 郎溪县| 青神县| 昭通市|