1 Jar Jar Links - A utility to repackage and embed Java libraries 2 Copyright 2007 Google Inc. 3 4 Command-line usage: 5 6 java -jar jarjar.jar [help] 7 8 Prints this help message. 9 10 java -jar jarjar.jar strings <cp> 11 12 Dumps all string literals in classpath <cp>. Line numbers will be 13 included if the classes have debug information. 14 15 java -jar jarjar.jar find <level> <cp1> [<cp2>] 16 17 Prints dependencies on classpath <cp2> in classpath <cp1>. If <cp2> 18 is omitted, <cp1> is used for both arguments. 19 20 The level argument must be "class" or "jar". The former prints 21 dependencies between individual classes, while the latter only 22 prints jar->jar dependencies. A "jar" in this context is actually 23 any classpath component, which can be a jar file, a zip file, or a 24 parent directory (see below). 25 26 java -jar jarjar.jar process <rulesFile> <inJar> <outJar> 27 28 Transform the <inJar> jar file, writing a new jar file to <outJar>. 29 Any existing file named by <outJar> will be deleted. 30 31 The transformation is defined by a set of rules in the file specified 32 by the rules argument (see below). 33 34 Classpath format: 35 36 The classpath argument is a colon or semi-colon delimited set 37 (depending on platform) of directories, jar files, or zip files. See 38 the following page for more details: 39 http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html 40 41 Mustang-style wildcards are also supported: 42 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6268383 43 44 Rules file format: 45 46 The rules file is a text file, one rule per line. Leading and trailing 47 whitespace is ignored. There are three types of rules: 48 49 rule <pattern> <result> 50 zap <pattern> 51 keep <pattern> 52 53 The standard rule ("rule") is used to rename classes. All references 54 to the renamed classes will also be updated. If a class name is 55 matched by more than one rule, only the first one will apply. 56 57 <pattern> is a class name with optional wildcards. "**" will 58 match against any valid class name substring. To match a single 59 package component (by excluding "." from the match), a single "*" may 60 be used instead. 61 62 <result> is a class name which can optionally reference the 63 substrings matched by the wildcards. A numbered reference is available 64 for every "*" or "**" in the <pattern>, starting from left to 65 right: "@1", "@2", etc. A special "@0" reference contains the entire 66 matched class name. 67 68 The "zap" rule causes any matched class to be removed from the resulting 69 jar file. All zap rules are processed before renaming rules. 70 71 The "keep" rule marks all matched classes as "roots". If any keep 72 rules are defined all classes which are not reachable from the roots 73 via dependency analysis are discarded when writing the output 74 jar. This is the last step in the process, after renaming and zapping. 75 76