可以Runtime.getRuntime.exec("cmd")
小程序的安全策略有可能不允许你执行本地命令

解决方案 »

  1.   

    按照以下方式,记住用双斜杠,我的msimn就是一个exe文件import java.lang.*;//包头必须要带
    Runtime.getRuntime().exec("d:\\Program Files\\Outlook Express\\msimn");记住要抛出异常
      

  2.   

    class ExecEmo
    {
    public static void main(String[] args)
    {
    Runtime r = Runtime.getRuntime();
    Process p = null;
    try
    {
    p = r.exec("d:\\md.exe");
    p.waitFor();
    }
    catch (Exception e)
    {
    System.out.println("Error executing notepad");
    }
    System.out.println("Notepad returned " + p.exitValue());
    }
    }
      

  3.   

    waitFor() 这个方法是什么意思呢?我怎么才能送分呀( 刚来不会呀) 
      

  4.   

    waitFor() 这个方法的意思是:causes the current thread to wait, if necessary, until the process represented by this Process object has terminated送分的方法:在我的专家门诊里按要结帖的问题,后面有一个管理按钮,按一下就知道了
      

  5.   

    core java 2中有java调用C语言程序的例子。
      

  6.   

    http://expert.csdn.net/Expert/topic/1122/1122963.xml?temp=.9581568
    这可是我的收藏