We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

StringIndexOutOfBoundsException while setting the license

Hi,

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

Currently my project folder is as below
ProjectName
src
main.java ( in this i am setting license with the code BarCodeLicense.setLicense(“Aspose.BarCode.Java.lic”);
lib
asposebarcode.jar
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(String.java:2684)
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)

@manjularani,

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.