Command line options

Deprecation notice
CheerpJ 2 is deprecated. Consider migrating to CheerpJ 3 .

The basic usage of the build script is:

Terminal window
./ application.jar

For more information about this script, see AOT optimization.


Shows all the command line options


Shows the CheerpJ version and the recommend loader.js to use in deployment.


Splits generated JS into smaller modules.


Do not automatically add the runtime to the class path.


Root of the native JS implementations for classes in this JAR file. Assuming the /natives directory exists:

Terminal window --natives=native/ some.jar


List of : separated JARs that this JAR depends on. Please note that all the listed JAR paths should be either relative to the target JAR or absolute.

Terminal window --deps dependency1.jar:dependency2.jar my_application_archive.jar


A directory where all the JARs are unpacked. This is useful to speed up multiple compilations of the same JARs and to select a different disk when not enough free space is available in the temporary directory. Keep in mind that the directory passed to the option must be manually created before the command is run.


File containing a list of classes that should be in the core module.


Generates a stripped version of the input JAR with all code replaced by nops for improved compression


Generate a packed version of the input JAR using the pack200 utility. Debug information and code are removed. To use this command you will require to have java installed on your machine.

Terminal window yourInput.jar --pack-jar yourOutput.jar

This action will overwrite your original .jar file with the packed one when using the same filename (necessary for your app to work). We recommend backing up your original files somewhere else to keep their state in case you need to use them again.


Generates stubs for all native methods from classes in this JAR. The parameter must be an existing directory, it will be populated with new JavaScript files for each class having native methods.

Terminal window
mkdir native/ --stub-natives=native/ some.jar

Note: Existing files in the passed directory will be overwritten.

CheerpJ uses a compression scheme to encode mangled signatures. The CHEERPJ_COMPRESS macro is used automatically by this command, but can also be used manually.

CHEERPJ_COMPRESSEncode the argument in parenthesis following such scheme.
CHEERPJ_SET_CLASSSet the current internal class for resolving fields when using CHEERPJ_FIELD and CHEERPJ_STATIC_FIELD macros.
CHEERPJ_FIELD and CHEERPJ_STATIC_FIELDThe compiler replaces this macro with the encoded field name, it assumes the current class has been set by CHEERPJ_SET_CLASS.


File containing a list of classes that should be compacted to the beginning and end of JAR file


Drop all dll/so/jnilib files from the JAR


List of ’,’ separated classes that should not be compiled. Example β€”ignore-classes com.a.b.ClassOne,org.c.d.ClassTwo


Number of parallel compilation jobs

Was this page helpful?
Suggest changes