/** * Extract the contents of a jar file. * * @param args An array of arguments. The first argument names the jar file to be extracted. The * first argument is required. The second argument names the directory in which to extract the * files from the jar file. The second argument is optional. */ public static void main(String[] args) { if (args.length < 1 || args.length > 2) { System.err.println( "Usage: java -classpath $PTII " + "ptolemy.util.FileUtilities jarFile [directory]\n" + "where jarFile is the name of the jar file\n" + "and directory is the optional directory in which to " + "extract."); StringUtilities.exit(2); } String jarFileName = args[0]; String directoryName = null; if (args.length >= 2) { directoryName = args[1]; } try { extractJarFile(jarFileName, directoryName); } catch (Throwable throwable) { System.err.println("Failed to extract \"" + jarFileName + "\""); throwable.printStackTrace(); StringUtilities.exit(3); } }