License File Cannot Be Found

Hi,

I’m having an issue with initializing the license in the code running on Tomcat. The same code works correctly during unit testing in Eclipse, but the environment is different there, so I suspect that this is classic classpath issue.

I have followed your instructions and simply referenced the license file without any folder qualifiers like this:

static
{
    License license = new License();
    try
    {
        license.setLicense("Aspose.Words.lic");
    }
    catch (Exception e)
    {
        log.error("Error with aspose license", e);
    }
}

I have placed the Aspose.Words.lic file first in the /lib directory whereAspose.Words.jdk16.jar resides, and then in the /classes directory where my class resides that has the code fragment above. Those are essentially the only two locations with executable code.

Could you shed some light here how this issue can be resolved?

Best regards,

Martin

Hi Martin,
Thanks for your request. Maybe in your case, you can simply read the license file to stream and apply it from stream:
https://reference.aspose.com/words/java/com.aspose.words/license/#setLicense-java.io.InputStream
In this case, your application will be independent on license file location.
Best regards,