1 3 20 21 package edu.neu.ccs.jmk.sun; 22 23 import sun.tools.jar.*; 24 import edu.neu.ccs.jmk.Operator; 25 import edu.neu.ccs.jmk.CommandFailedException; 26 import java.io.*; 27 28 39 public final class Jar 40 implements Operator 41 { 42 public String getName() 43 { 44 return("Jar"); 45 } 46 47 public void exec(String [] _args, PrintWriter _out) 48 throws CommandFailedException 49 { 50 Main ji; 51 52 if ( _args.length == 0 ) 53 throw new CommandFailedException("No args to " + getName()); 54 try 55 { 56 OutputStream os=new OutputStreamToPrintWriter(_out); 57 PrintStream ps=new PrintStream(os); 59 ji = new Main(ps, ps, "jar"); 60 61 if ( ji.run(_args) == false ) 62 throw new CommandFailedException(getName() + " failed"); 63 64 } catch ( CommandFailedException ex1 ) 65 { 66 throw ex1; 67 } catch ( Exception ex2 ) 68 { 69 throw new CommandFailedException(getName() + " threw an exception ->"+ex2.toString()); 70 } finally 71 { 72 ji=null; 73 System.gc(); 75 } 76 } 77 78 } 79 | Popular Tags |