Advanced Installer 6.7 has a new licensing and registration feature which allows for time-limited demos/trials and registration of installed software.

Caphyon, the maker of Advanced Installer, provides code samples and documentation on licensing integration for C++ and C# applications. To use this feature, the application must make a call into an Advanced Installer library and handle its return code.

The library is a gatekeeper to the rest of the application, effectively deciding whether or not the application is allowed to run. It determines the software’s trial status and displays a registration dialog, terminates the application, or returns a code, accordingly. The Java implementation of this feature works a little differently.

For those using the Java Launcher, integrating the licensing feature is easy: simply add the Java Product on the Licensing Options tab. But, what about those who don’t use Java Launcher? Or those that wish to enable users to register from within the application?

There is no official documentation which answers these questions, but based on a discussion following a request for help I posted on the Advanced Installer forums, I was able integrate AI’s licensing feature into my Java application without using the Java Launcher.

My solution mirrors the C++ implementation and is remarkably simple. Thanks to Cosmin, a member of the Advanced Installer support team, for sending me in the right direction.

public class LicenseChecker {
    private static final String LIBRARY_KEY = "Replace this String with the Trialware/Registration Library Key";

    public static void main(String args[]) {
        int i = TrialLibrary.INSTANCE.ReadSettingsStr(LIBRARY_KEY, null);
        switch (i) { //
        case 0:
            System.out.println("Thank you for registering this program.");
        case 2:
            System.out.println("Thank you for trying this program.");
        System.out.println("Program will continue.");
        // ...

    interface TrialLibrary extends Library {
        final TrialLibrary INSTANCE = (TrialLibrary) Native.loadLibrary("Trial", TrialLibrary.class); // loads Trial.dll
        int ReadSettingsStr(String keyCode, HWND hwnd);
        int DisplayRegistrationStr(String keyCode, HWND hwnd);

Note: The above uses Java Native Access (JNA) to invoke the Advanced Installer library.