Running the Obfuscator - RetroGuard Documentation


Prev   Contents   Next

RetroGuard is designed to be integrated into an build procedure, so that obfuscation can become a consistently applied and automatic part of your build and QA cycle. For this reason, it is a command line tool with its options being set through a script file - this enforces stability from build to build.

One way to view obfuscation is as a phase in your build process where the interface to your Jar archive is specified and only that interface is left accessible to the outside world. This interface is the list of classes, interfaces, methods and fields that you provide in the RetroGuard script file.

Command line

The command for running RetroGuard has the form,

java RetroGuard [INPUT-JAR [OUTPUT-JAR [SCRIPT [LOGFILE]]]]
where:
  • INPUT-JAR is the filename for your original, unobfuscated Jar file (defaults to 'in.jar').
  • OUTPUT-JAR is the filename that will be used for the obfuscated Jar file (defaults to 'out.jar').
  • SCRIPT is the filename of the RetroGuard script file, specifying identifiers which are to be left unobfuscated (defaults to 'script.rgs').
  • LOGFILE is the filename that will be used for the text log of this obfuscation run (defaults to 'retroguard.log').
Each group of arguments in square brackets '[...]' above is optional. If INPUT-JAR cannot be read, or if OUTPUT-JAR or LOGFILE cannot be written, execution is terminated with a warning message.

Since the 'Main-Class' attribute in 'retroguard.jar' is set to 'RetroGuard', it is also possible to use the following command line,
java -jar retroguard.jar [INPUT-JAR [OUTPUT-JAR [SCRIPT [LOGFILE]]]]
Note that this is suitable only for simple cases where all classes are contained in the input jar file. If the classes to be obfuscated depend on libraries, these should be included in the classpath during obfuscation and so the command line at the top of the page must be used. (Using 'java -jar' will cause all other classpath options to be ignored.)


Prev   Contents   Next
 Copyright © 1998-2007 Retrologic Systems.
 All rights reserved.