License4J Java Software Licensing, License Manager
- Latest version 4.6.9 -
Videos | Runtime Library Integration | Quick Start Integration | License Manager GUI | Online.License4J
easyValidate Integration | Floating License Server | Auto License Generation and Activation Server

License4J Library Integration Quick Start

There are two quick start application example in examples folder. "example10" folder includes a Netbeans project (LICENSE4J-QuickStartLicensing-Example2). This example has a single main frame and a licensing jdialog to display license information. There are comment blocks in source, follow comments and copy licensing gui (customize as you like). In this video tutorial, quick start example is used and licensing is added to a small Java application in less than 15 minutes.

Another sample quick start application can be found in "example5" folder; it can be used to easily integrate licensing into any Java Swing software. It includes license information and license input dialogs with a general license load/save helper class. It can be directly used as a library or modified/customized for integration.

Quick start integration example performs the following licensing tasks.

"example6" folder is a single class application which includes quick start example jar file as a library. There is a single JFrame as application main and all license actions are integrated with just a few method calls.

Following are screenshots from sample application.

Quick Start Licensing Example 1

Quick Start Licensing Example 1


Sample Code

Following code is available in example6. Basically, it checks for a valid license just before main gui window displayed.
       ProductLicense productLicense = new ProductLicense(
                // the file to save license
                System.getProperty("user.home") + File.separator + "sample-app-license-file.lic",
                // public key
                "30819f300d06092a864886f70d010101050003818d003081893032301006"
                + "072a8648ce3d02002EC311215SHA512withECDSA106052b81040006031e0"
                + "0044f19c44ee47bc7a7f61af76c1b060a750b9bee5c9907452c8f34d42fG"
                + "02818100a1f9ed4070844ab588914b06f68f49f36ba581ee589901bce5a8"
                + "66c3753f32b320313b1f7be69753d97993848feb81351bc9f9df23fb0c93"
                + "a06a56c964a2d37d216e8fb557fc1d8b5dd9c740052f66afde48b0d515fe"
                + "ce608c04ced6e11475f003RSA4102413SHA512withRSA9103c41df57a5d4"
                + "8969e961326cf1e7233f4cd1c0d7121204a6da690e21a17ab0203010001",
                // a trial license key
                "7IDZ9-2VY4C-SIDNK-JPHVE-KL7VA",
                // since trial license key is given, this must be null
                null,
                // this is internal string for license keys
                "some-internal-string",
                // this the product id
                "examples",
                // activation server is null, so we use Online.License4J
                null);

        /**
         * Initialize LicenseInformationGUI, and run check method. GUI will not
         * be displayed if there is a valid license.
         */
        LicenseInformationGUI gui = new LicenseInformationGUI(null, true, productLicense);
        boolean ok = gui.check();

        /**
         * If gui.check() method returns true, it means there is a valid
         * license, so start your main frame.
         */
        if (ok) {
            /* Create and display the form */
            java.awt.EventQueue.invokeLater(new Runnable() {
                @Override
                public void run() {
                    new MainJFrame().setVisible(true);
                }
            });
        }
                
Privacy Terms of Use Contact Us