Process exec(String[] cmdarray) 
          Executes the specified command and arguments in a separate process. 这是从jdk里找到的用法,输入参数的

解决方案 »

  1.   

    通过以下语句可以输出结果。Process proc=Runtime.getRuntime().exec(String []cmd)InputStream in = proc.getInputStream();
                    
    BufferedReader line = new BufferedReader(new InputStreamReader(in));
    String l = line.readLine();
        while (l!=null)
              {
              System.out.println(l);
              l = line.readLine();
             }
            
                    in.close();
      

  2.   

    else if (e.getSource ()==btn_del)
                 {DefaultMutableTreeNode node=(DefaultMutableTreeNode)tree.getLastSelectedPathComponent() ;
                   String str=node.toString() ;
                   if(node.isLeaf())
                     {try
                       {File f=new File(node.getParent() .toString().trim() +str.trim()+".txt");
                       FileWriter tofile=new FileWriter("gxy.bat");
                       BufferedWriter out =new BufferedWriter(tofile);
                       String temp1="del "+f.getAbsoluteFile() .toString() ;//del f:\my_bag\JBuiler6.0\Swing_study\5月 7日.txt
                       out.write(temp1,0,temp1.length() );
                       out.flush() ;
                       tofile.close() ;out.close() ;
                       }
                       catch (IOException e1){}
                      }
                   del();
                 }
              }        void del()
              {try
                {Runtime ce=Runtime.getRuntime() ;
                ce.exec("gxy.bat") ;
                }
               catch (IOException e1){}
              }
    这是部分程序,
    看看对你是否有帮助。