Alternate to License.IsLicensed Method | Check If a Valid License of Aspose.Words for Java is Applied?

Dear Team,

In previous versions (at least in 19.8) the License class had a then already deprecated method isLicensed.
I see that in the current release (20.9, and maybe even before) that method has been removed.
Is there any other way that I can now check that the License is effectively licensed?
Is there a way to check if the License has been expired?

Many thanks for your suppoirt

Patrick Vanbrabant

@PatrickVB,

The License.isLicensed() method is obsolete, and now a better way is to declare a global variable to determine whether a valid license has been applied:

boolean isLicensed = false;
try {
    License lic = new License();
    lic.setLicense("E:\\temp\\aspose.total.java.lic");
    isLicensed = true;
} catch (IllegalStateException ex) {
    isLicensed = false;
}

if (isLicensed) {
    Document doc = new Document("E:\\temp\\in.docx");
    doc.save("E:\\Temp\\awjava-20.9.pdf");
} else {
    System.out.println("License not applied");
}

In Java, the License.setLicense() method will throw IllegalStateException for an invalid/wrong/expired license etc.

Hi Awais,

Many thanks for the detailed explaination.
I will do as recommended.

Thanks
Patrick