Free Support Forum -

Cant set the license


I try to set the license from my servlet and receive error: It seems that there is no such mwthod named setLicense will take string as paramener. Please help. Urgent !!

java:86: cannot find symbol
symbol : method setLicense(java.lang.String)
location: class com.aspose.cells.License

and I find fopllowing code from web. what should I use for charset 1 and charsey 2 ?

File file = new File("..."); //license file
byte[] buffer = new byte[(int)file.length()];
FileInputStream fis = new FileInputStream(file);;
String xml = new String(buffer, charset1);
buffer = xml.getBytes(charset2);
ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
new License().setLicense(bais);


You may use the overloaded method i.e.:
setLicense( stream)
The usage of license file is to build one InputStream(such as FileInputStream) and pass the InputStream to License.setLicense() method. So the license file can be put into any place at your web application where you can access it in the same way as common file.

com.aspose.cells.License lic = new com.aspose.cells.License();
lic.setLicense(new FileInputStream(stringLicenseFilePath));