jNorm is a tool that normalizes Java bytecode generated in different compilation environments. Bytecode that originates from the same source code will be transformed into a representation that is independent from the used JDK with most compilation differences removed.
Java 8 or higher needs to be installed on your system to run jNorm.
jNorm supports the default compilers of Oracle's JDK and OpenJDK (javac). More specifically it is designed to remove differences introduced by JDK versions 5-8, 11 and 17.
jNorm additionally employs a normalization of target level differences. The designed difference removal range supports Java versions 5-8 and 11.
To build jNorm from its source code run the following command:
mvn package assembly:single
This command will create an executable JAR. This jar can be found in jnorm-cli/target
and is named jnorm-jar-with-dependencies.jar
.
The simplest way to invoke jNorm is the following:
java -jar jnorm-jar-with-dependencies.jar -i path/to/bytecode -n
This command will start jNorm and normalize the files in the path/to/bytecode directory and output the normalized Jimple files to the default output directory.
If you want to apply a heavier normalization, use the following command:
java -jar jnorm-jar-with-dependencies.jar -i path/to/bytecode -o -n -s -a -p -d path/to/output
This command will optimize, normalize and standardize the bytecode and additionally remove all typechecks to remove further differences. The normalized files will be formatted and output to the specified directory.
Parameter | Functionality |
---|---|
-i <dir> | Set input directory |
-d <dir> | Set output directory |
-p | Apply pretty printing for output |
-o | Apply optimizations |
-s | Apply standardization |
-n | Apply normalizations |
-a | Apply aggressive normalizations |
-r <int> | Apply renaming with specified hash look-ahead window |
-r2 | Apply simple renaming (cannot be used in combination with -r) |