1 22 23 package org.apache.derbyTesting.functionTests.util; 24 import java.io.*; 25 26 27 31 public class JarUtil { 32 33 44 public static void unjar(String jarpath, String outputdir) 45 throws ClassNotFoundException , IOException, InterruptedException 46 { 47 if ( outputdir == null ) { 48 outputdir = System.getProperty("user.dir"); 49 } 50 File jarFile = new File((new File(outputdir, jarpath)).getCanonicalPath()); 51 52 String jarCmd = "jar xf " + jarFile.getPath(); 54 Process pr = null; 56 try 57 { 58 pr = Runtime.getRuntime().exec(jarCmd); 60 61 pr.waitFor(); 62 pr.destroy(); 64 } 65 finally { 66 if (pr != null) 67 { 68 pr.destroy(); 69 pr = null; 70 } 71 } 72 } 73 } | Popular Tags |