CheerpJ 1.2 released
ProGuard integration, system clipboard support, new optimisations
This release introduces two features which have been highly requested by our commercial users: an integration with ProGuard to allow major reductions in startup time and download size, and full integration with the system clipboard, allowing to copy and paste between the browser and the system. This release introduces further optimisations to memory use, size of generated code and networking.
It is easy to try CheerpJ 1.2! Download the new version of the compiler here, and follow our tutorials to get started. If you have been using a previous version of CheerpJ, make sure to rebuild your project, and change your CheerpJ runtime loader to:
ProGuard integration for startup and size optimisations
ProGuard can automatically trace the classes used by an application, and generate a minimised version of a Java archive in which unused classes, methods and fields are automatically purged. This usually leads to a very significant reduction in the size of the package, and to a startup performance speedup, especially when multiple third-party libraries are used.
Since CheerpJ fully supports runtime reflection, ProGuard may end up removing used code, causing unexpected errors at runtime.
To provide a more accurate trace of classes that are used by an application, including those invoked via reflection, CheerpJ 1.2 introduces a special initialisation option:
A CheerpJ application can be initialised with this option, and tested extensively in order to generate a comprehensive list of classes. After this phase, the new
method can be used to generate a configuration file (
cheerpj.pro) that can be used with ProGuard.
For more details, including a step-by-step guide on how to optimise a CheerpJ application with ProGuard, you can check our Documentation.
Integration with system clipboard
By default, CheerpJ provides an internal clipboard (local to the converted Java application) that can be accessed with the usual
Cmd+V) shortcuts. This clipboard is not normally integrated with the system, and therefore copy-pasting from/to other applications or browser tabs is not allowed.
CheerpJ 1.2 introduces a new system integration, to be enabled optionally, which allows a CheerpJ application to interface directly with the system clipboard.
To enable this integration, a special initialisation option is required:
Browsers enforce serious limitations on how the system clipboard can be accessed. In practice it is generally accessible when the
Ctrl+V shortcuts are used (
Cmd+V on macOS).
Due to these limitations, CheerpJ provides the following UX to access the system clipboard:
Cmd+Con macOS): the user has to enter the shortcut twice to give CheerpJ access to the system clipboard and perform the copy (after keying in
Ctrl+Cthe first time, CheerpJ will block the execution while waiting for the second
Cmd+Von macOS): this shortcut behaves normally, with no difference with native execution.
- Menu based Copy/Paste:
Ctrl+Vare needed to access the clipboard. CheerpJ will block the execution while waiting the appropriate shortcut.
In future version of CheerpJ, we will add an additional clipboard mode to take advantage of a the new permission-based browser API for clipboard access which is currently being standardized. This future mode will provide native like user experience in all cases.
In addition to ProGuard integration and system clipboard integration, CheerpJ 1.2 introduces further optimisations and several bugfixes:
- Extended support for window resizing
- Added support for sealed packages
- Further optimisations of JNI calls
- Improved cleanup of threads
- Improved support for reflection
- Improved HTTP(s) Java networking support (based on XHR)
Get in touch