Save This Page
Home » openjdk-7 » net.bonzoun » cocodonkey » [javadoc | source]
    1   //
    2   //  Util.java
    3   //  CocoDonkey
    4   //	$Id: Util.java,v 1.2 2002/07/05 18:38:33 fortun Exp $
    5   //
    6   //  Created by Fred Bonzoun on Fri Jul 05 2002.
    7   //  Copyright (c) 2002 Bonzoun. All rights reserved.
    8   //
    9   //  This library is free software; you can redistribute it and/or modify
   10   //  it under the terms of the GNU Lesser General Public License as published
   11   //  by the Free Software Foundation; either version 2.1 of the License, or
   12   //  (at your option) any later version.
   13   //
   14   //  This library is distributed in the hope that it will be useful,
   15   //  but WITHOUT ANY WARRANTY; without even the implied warranty of
   16   //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   17   //  GNU Lesser General Public License for more details.
   18   //
   19   //  You should have received a copy of the GNU Lesser General Public License
   20   //  along with this program; if not, write to the Free Software
   21   //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   22   //
   23   
   24   package net.bonzoun.cocodonkey;
   25   
   26   public class Util {
   27   
   28       public static boolean launchShell(String cmd, java.io.File dir) {
   29           try {
   30               Process p;
   31               if (dir != null)
   32                   p = Runtime.getRuntime().exec("sh -s", null, dir);
   33               else
   34                   p = Runtime.getRuntime().exec("sh -s");
   35               java.io.PrintStream in = new java.io.PrintStream(p.getOutputStream());
   36               in.println(cmd);
   37               in.flush();
   38               return true;
   39           }
   40           catch(java.io.IOException e) {
   41               e.printStackTrace();
   42               return false;
   43           }
   44       }
   45   }
   46   
   47   
   48   // $Log: Util.java,v $
   49   // Revision 1.2  2002/07/05 18:38:33  fortun
   50   // Current dir param for launchShell
   51   //
   52   // Revision 1.1  2002/07/05 00:02:31  fortun
   53   // *** empty log message ***
   54   //

Save This Page
Home » openjdk-7 » net.bonzoun » cocodonkey » [javadoc | source]