Zelix KlassMaster - Documentation
 

The open Statement

The ZKM Script open statement opens class files and J2ME JAD files for processing by Zelix KlassMaster. Successive open statements do not have a cumulative effect.

If you open an archive that contains nested JAR, ZIP, WAR or RAR archives then the nested archives will also be opened for obfuscation. This typically happens in the case of J2EE EAR archives. Occassionally this can cause a problem where your EAR contains a nested third party JAR that you don't want to obfuscate. In such cases you can use the -"x.ear!y.war!WEB-INF/lib/z.jar" syntax to tell Zelix KlassMaster to not open (i.e. "skip") a specified nested archive file.

You can also use the -"x.jar!com/mycompany/MyClass.class" syntax to tell Zelix KlassMaster to not open (i.e. "skip") a specified class within an archive. However, if you do this then you must make sure that the class does not access any of the classes that are to be obfuscated.

Examples

open "c:\directory1\Class1.class" //a single class file
     "c:\directory1\MyJar.jar"    //all the class files in a single jar
     "c:\directory2"              //all the class files in a single directory
     "c:\directory3\*"   //all the class files in a single directory AND its subdirectories
     "c:\directory1\MyJar.jad"; //J2ME JAD file will be associated with the JAR it specifies

open "c:\directory1\MyEar.ear"     //Open the EAR and all its nested WAR and JAR files
     //Don't open the archive X.jar (in the WEB-INF/lib/ directory) nested within MyWar.war nested within MyEar.ear
     -"MyEar.ear!MyWar.war!WEB-INF/lib/X.jar"
     //Don't open ANY zip file archive (in the WEB-INF/lib/ directory) nested within MyWar.war nested within MyEar.ear
     -"MyEar.ear!MyWar.war!WEB-INF/lib/*.zip"
     //Don't open the class file com/mycompany/MyClass.class within MyJar.jar nested within MyEar.ear
     -"MyEar.ear!MyJar.jar!com/mycompany/MyClass.class"; 

Explanation

The statement's action for each of the sourceName types is
Type Action
class file Open the specified class file
ZIP file Open all class files stored in the ZIP file
JAR file Open all class files stored in the JAR file
EAR file Open all class files stored in the nested WAR, JAR or RAR files
directory Open all class files stored in the directory
directory followed by an "*" Open all class files stored in the directory and all of its subdirectories
J2ME JAD file Open the JAD file and associate it with the opened JAR that it specifies

Syntax

"open" "\"" sourceName "\"" ("\"" sourceName "\"" | ("-" "\"" skipName "\""))* ";"

where
  • sourceName is the fully qualified pathname of a:
    • class file or
    • JAR file or
    • EAR file or
    • WAR file or
    • RAR file or
    • ZIP file or
    • directory or
    • directory followed by an "*" or
    • J2ME JAD file
  • skipName is the path to a nested archive or class file that should NOT be opened. The levels of nesting must be separated by "!" characters. Note that a skipName can contain a "*" wildcard in the final archive name. For example:
    • x.ear!y.war!WEB-INF/lib/z.jar OR
    • x.ear!y.war!WEB-INF/lib/*.jar OR
    • x.jar!com/mycompany/*.class
 
ZKM Script classpath statement The ZKM Script Language ZKM Script trimExclude statement