Troubleshooting

The most current readme.html file is on our web site

Messages

JCloak displays progress messages when the verify switch is turned on (-v command line option) or when the Verbose(true) directive is in the project file.

JCloak may also display error or warning messages, with or without verbose prints. The GUI will keep error and warning messages in a log that can be viewed from the menu item 'View | Show Errors'.

Errors

ERR: '<name>' load failed. (is super-class of '<dc-name>', error: <reason>)
JCloak failed to load the class <name>. The class is the super-class of <dc-name>. <reason> is the error JCloak got trying to find or load the class <name>.

JCloak cannot obfuscate classes that do not have a complete derivation tree. You must make the missing class available on the obfuscation classpath.

 
ERR: '<name>' load failed. (is super-interface of '<dc-name>', error: <reason>)
JCloak failed to load the class <name>. The class is the super-interface of <dc-name>. <reason> is the error JCloak got trying to find or load the class <name>.

JCloak cannot obfuscate classes that do not have a complete derivation tree. You must make the missing class available on the obfuscation classpath.

Warnings

WARN: Class "<class-name>" contains invalid reference to "<refd-class>.<signature>"
Every reference made by the classes JCloak is obfuscating is validated. This error is reported when the class <class-name> references the method or field <signature> in class <refd-class> and JCloak cannot resolve the reference. Note that when obfuscating code that is cleanly compiled in a single compilation JCloak will never report this error. This error is usually caused by:
  1. Mixing and matching classes from two separate compilations that have incompatiable changes (see section 12.3.3, Resolution of Symbolic References in the Java Language Specification)
  2. Mixing and matching obfuscated and un-obfuscated classes on the classpath.
  3. Attempting to obfuscate third party code for which you do not have all classes the code refernces.

For example: Class "public class C09" contains invalid reference to "public class Java2Demo.pLjavax/swing/J TabbedPane;"
This error was the result of mixing obfuscated and unobfuscated classes on the same classpath. The referenced method field in this case, 'javax.swing.JTabbedPane p' did not exist in the class Java2Demo. Mixing and matching classes from two different compilations can also cause this error.

JCloak will not obfuscate <signature> unless the reference can be resolved.
 
WARN: class load failed for reference, '<class>.<signature>' ref. from '<ref-class>', error: <reason>
JCloak tried to load the class <class> because the class <ref-class> referenced the method or field <sig> in <class>. The class load failed for the indicated <reason>.

JCloak will not obfuscate <signature> unless the class can be loaded.
WARN: '<class>' already loaded from '<classpath>' ignoring '<classfilepath>'
This warning occurs when multiple instances of a class are loaded from different classpaths. JCloak searches for a class on the classpaths in the order entered specified (file order of AddToClassPath() directives). If the class is found on more than one classpath
 
JCloak only uses the class encountered first on the classpath, the duplicate class is ignored.

Reason Messages

The reason messages detail the cause of the error or warning message the reasons are listed below.
Can't find class '<name>' on classpath "<classpath-list>"
JCloak has failed to find the indicated class. The class was either referenced by a class JCloak previously loaded, or was named in a configuration directive. The classpath indicated is the classpath specified in the JCloak configuration file, this is the classpath JCloak attempted to find the class on. Either the class does not exist or the class file was corrupted.
 
ignored '<name>', from classpath '<path>', Reason: Class corrupted, invalid UTF8 String
JCloak detected a corrupted class file located in path <path>. This is a warning message as JCloak keeps looking for the class on some other portion of the classpath.
 
'<name>' package not valid with path '<class-file>' and classpath '<path>'
The class <name> located in path <class-file> is not in a valid sub-path of <path>. That is the package path implied by <path> does not match the package name for <name>. This message may also be the reason for the "WARNING: ignored ..." message. Classes not found on a valid path are always ignored by JCloak
Common pitfalls

classpath issues

When you specify a classpath as the initial classpath for JCloak to scan for classes, either via a class file or the subdirectory. JCloak will ignore any invalid class files found, that is, class files that do not belong on the classpath. In addtion, if JCloak encounters a sub-path that has only invalid class files it will ignore all sub-paths beneath that path as well.

OutOfMemoryError

JCloak uses a considerable amount of Java heap, especially when removing unreferenced classes. If you use the windows executeable launchers the memory size is automatically set to the free physical memory. Use the java option '-Xmx128M' to set the max heap memory size to 128MB. So for example to run JCloak with 128M max heap:

java -Xmx128M -jar JCloak.jar [jcloak options]

 

Tracing

JCloak command line includes two options for tracing. Class trace, '-c ' traces JCloak handling of the class with fully qualified name . And Method trace, '-t ' traces JCloak handling of the method with the simple named .

The verify switch '-v' also takes an level argument, -v0 is basic trace, -v1 traces more, -v2 reams of output.

 

The Verify utility

The Verify command line utility class is now included with JCloak.  Verify checks that all references made by a set of classes can be statisfied.  The usage is:

usage: java Verify [-v] [-java2] [-cp <classpath>] <directory>
                   [-v] [-java2] [-cp <classpath>] <jar-file>

        

Verify loads every class found on the target classpath <directory> or in the target jar file <jar-file> and scans the bytecode in the class for references.  For each reference Verify will load the referenced class and verify the referenced symbol exists.

Verify looks for referenced classes on the environment CLASSPATH or, if -java2 is specified, on the CLASSPATH environment and in the Java 2 runtime rt.jar.  You can specify additional classpaths in a list <classpath> with the -cp argument.

The -v argument enables verbose trace prints.

For example, here is the output when Verify is run on JCloak itself:

C:\JCloak>java -cp c:\jcloak\JCloak.jar Verify .\JCloak.jar
Start time: Thu Mar 25 09:54:40 PST 1999
add reference path D:\jdk1.2\jre\lib\rt.jar
add reference path D:\jdk1.2\jre\lib\i18n.jar
add target path .\JCloak.jar
Loading and scanning classes...done scanning classes.
Verifying all interfaces implemented...
Done verifying interfaces implemented, 0 errors.
Verifying all method/field/class references...
Done verifying references, 0 errors.
Done, total errors=0

Note that Verify cannot detect classes referenced by forName().