StringIndexOutOfBoundsException while setting the license


I have purchased the license for aspose.barcode for java.

Currently my project folder is as below
src ( in this i am setting license with the code BarCodeLicense.setLicense(“Aspose.BarCode.Java.lic”);

It worked fine when i tested from eclipse.

Now I have created executable jar file and deployed in Unix.

When i am running the jar file in Unix, getting the below error

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.substring(
at com.aspose.pdf.l10y.lf(Unknown Source)
at com.aspose.pdf.l10y.lj(Unknown Source)
at com.aspose.pdf.l10y.lI(Unknown Source)
at com.aspose.pdf.License.setLicense(Unknown Source)

But if I place the license file in the unix folder where jar file is there…it is working fine. But I don’t want to place the license file seperately in unix box. How can i achieve that ??

Project folder structure in screenshot

image.png (4.3 KB)


Your error shows that you are using Aspose.PDF for Java API and the exception is related to it, so kindly do post your issue/query in Aspose.PDF forum where one of our fellow colleagues from Aspose.PDF team will assist you soon.