Class License


  • public final class License
    extends Object
    This is the license management system for the library. To use this library in the client program, you need a valid license. Before any API calls to this library, the client program needs to specify the license by either:

    By default, the license file is assumed to be located under the same directory as the nmdev library jar file, runtime working directory, or classpath. If the license file is moved to elsewhere, the client program can specify the new location by calling setLicenseFile(java.io.File).

    Another way to set the license programmatically is to call setLicenseKey(java.lang.String) with the key string. Once you got a valid license, you can copy the license key in the license file. Using setLicenseKey(java.lang.String), the file I/O for loading license file can be avoided.

    See Also:
    License Agreement
    • Field Detail

      • LICENSE_FILE_PROPERTY

        public static final String LICENSE_FILE_PROPERTY
        The system property term for setting license file. Besides setLicenseFile(java.io.File), license file can be specified by system property using -D option in 'java' command.
        See Also:
        Constant Field Values
      • DEFAULT_LICENSE_FILES

        public static final String[] DEFAULT_LICENSE_FILES
        Default license file names.
      • DATE_FORMAT_STRING

        public static final String DATE_FORMAT_STRING
        Date format for all kinds of dates in a license file.
        See Also:
        Constant Field Values
    • Method Detail

      • setLicenseFile

        public static void setLicenseFile​(File licenseFile)
        Overrides the default license file. This has to be called before the default license is loaded.

        A license file can only be set once. All subsequent calls will lead to RuntimeException.

        Parameters:
        licenseFile - the license file
      • setLicenseKey

        public static void setLicenseKey​(String key)
        Sets the license key for this invocation.

        A license file can only be set once. All subsequent calls will lead to RuntimeException.

        Parameters:
        key - the license key
      • getVersion

        public static String getVersion()
        Gets the version number. The version number is in the format:
         <major version>.<minor version>.<bugfix version>
         
        Returns:
        the version number
      • getLicenseKey

        public static String getLicenseKey()
        Gets the license key string of the current license. The returned string can be passed into setLicenseKey(java.lang.String) for setting up license programmatically without file I/O.
        Returns:
        the license key string
      • getLicenseLocation

        public static String getLicenseLocation()
        Gets the location of the current loaded license.
        Returns:
        the license location