2009-08-06 107 views

回答

4

事实证明,他们可以。

5

我已经使用过这个在Windows系统上启动的东西从来没有在Mac上尝试过它。

public void launchScript(String args) 
{ 
    String cmd = null; 
    try 
    { 
     cmd = getParameter(PARAM_CMD); 
     System.out.println("args value : = " + args); 
     System.out.println("cmd value : = " + cmd); 
     System.out.println("Full command: = " + cmd + " " + args); 
     if (cmd != null && !cmd.trim().equals("")) 
     { 
      if (args == null || args.trim().equals("")) 
      { 
       final String tempcmd = cmd; 
       AccessController.doPrivileged(new PrivilegedAction() { 
       public Object run() { 
       try 
       { 
        Runtime.getRuntime().exec(tempcmd); 
       } 
       catch (Exception e) 
       { 
        System.out.println("Caught exception in privileged block, Exception:" + e.toString()); 
       } 
       return null; // nothing to return 
      } 
      });      
       System.out.println(cmd); 
      } 
      else 
      { 
       final String tempargs = args; 
       final String tempcmd1 = cmd; 
       AccessController.doPrivileged(new PrivilegedAction() { 
        public Object run() 
        { 
         try 
         { 
          Runtime.getRuntime().exec(tempcmd1 + " " + tempargs); 
         } 
         catch (Exception e) 
         { 
          System.out.println("Caught exception in privileged block, Exception:" + e.toString()); 
         } 
         return null; // nothing to return 
        } 
       });       
       System.out.println(cmd + " " + args); 
      } 
     } 
     else 
     { 
      System.out.println("execCmd parameter is null or empty"); 
     } 
    } 
    catch (Exception e) 
    { 
     System.out.println("Error executing command --> " + cmd + " (" + args + ")"); 
     System.out.println(e); 
    } 
} 
0

唯一相关的问题我知道的是,使用Internet Explorer在Windows Vista上的老“经典”插件,小程序是在一个“低诚信”的过程,这停止了是特别有用的运行。

和往常一样,我平常的建议是在签署任何代码之前知道你在做什么。

+0

是的。我需要明确地定位mac,所以这不是问题。不过很高兴知道。 – 2009-08-21 02:06:56

+0

想想吧,OS X的“安全带”可能会应用于浏览器并导致问题。我不完全确定苹果在采用PlugIn 2方面的表现。 – 2009-08-21 02:37:16

相关问题