Free Support Forum - aspose.com

License setLicense() problems

I have tried several different ways to get this working. I finally found something that works, but it keeps treating as though it is an Evaluation license. I have this working in an old build of my Application. The new build I have been working on has had no issues during development. I use NetBeans6.0 and I have set the VM to 1.5.0_06. In the IDE I don’t receive errors, but when I execute the jar file I get either signature invalid or an extra Excel Worksheet that complains about an evaluation version.

My code for the license with commented attempts at different ways to get it to work. What should I use to get the file from the jar? Should I just put the file in the working directory and use the FileInputStream? I would rather use the reflection classes is that possible?

public void installLicenseFromJar() throws AsposeException {

//ClassLoader loader = getClass().getClassLoader();
//URL source = null;
//source = loader.getResource(“Aspose.Cells.lic”);

//URL source = getClass().getResource("/com/dande/cabs/vznclient/Aspose.Cells.lic");
//System.out.println(source);

License license = new License();
//FileInputStream stream = null;
InputStream stream = null;

try {
stream = getClass().getResourceAsStream(“Aspose.Cells.lic”);

//URLConnection connection = source.openConnection();
//stream = connection.getInputStream();
//stream = new FileInputStream(“Aspose.Cells.lic”);

license.setLicense(stream);
} catch (Exception e) {
System.out.println(“EXCEPTION ->” + e);
System.out.println(“EXCEPTION ->” + e.getMessage());
e.printStackTrace();
throw new AsposeException(“Unable To Initialize License For Excel Plug-In”);
} finally {
try {
if (stream != null) {
stream.close();
}
} catch (Exception e) {
System.exit(0);
throw new AsposeException(“Could not close Aspose license file.”);
}
}
}

Hi,

Which version of Aspose.Cells for java you are using. Is it possible that your license is expired. Normally when you purchase a license, you may use this license file with any newer version / hot fixes released for the next whole year. Does the license file works fine with some older version(s)?

We will also check and get back to you soon.

Thank you.

Hello Amjad,

Here is the information in the Manifest file from Aspose.Cells.jar.

Name: Aspose.Cells for Java
Specification-Title: Aspose.Cells for Java
Release-Date: 2006.04.18
Implementation-Title: Aspose.Cells for Java
Specification-Vendor: Aspose Pty Ltd
Specification-Version: 1.4.3.0
Implementation-Version: 1.4.3.0
Implementation-Vendor: Aspose Pty Ltd

I have contacted purchasing at my company for an account # etc.

Thanks for your help,
Robert

Hello Amjad,

Just to circumvent any issues with the license I went ahead and renewed my order. I should be receiving a new license shortly. Hopefully, this will work with the latest and greatest software.

I will post another message with the results of this.

Thanks,
Robert

Hello Amjad,

Renewing and applying the latest and greatest code solved the problem. I was able to use the getClass().getResources(…) with URLConnection code and I was able to embed the license file in my Jar, so I don’t have to have a copy of the license just out there which is cool.

Thanks,
Robert Armenta

Hi Robert,

That's great :-)