在mac操作系统上,如何打开一个本地的html文件

解决方案 »

  1.   

    我用如下的代码不好用,这个据说是mrj3.1以后都可以的mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");openURL = mrjFileUtilsClass.getDeclaredMethod("openURL", new Class[] { String.class });openURL.invoke(null, new Object[] { url });是不是我引用的Class.forName有问题?
      

  2.   

    static void openMacURL(String url) {
        try {
          Class MRJFileUtils = Class.forName("com.apple.mrj.MRJFileUtils");
          Method openMethod = MRJFileUtils.getDeclaredMethod("openURL",
              new Class[] {String.class});
          openMethod.invoke(MRJFileUtils, new Object[] {url});
        }
        catch (Exception e) {
          e.printStackTrace();
        }
      }