Free Support Forum -

How to apply document viewer API license in Java

Good morning,
we tried to use the license file (Java). Unfortunately, the application works in demo mode only.
public class SimpleGroupDocsTest {

public static void main(String[] args) {

System.out.println(“SimpleGroupDocs started :)”);
SimpleGroupDocsTest simpleGroupDocs = new SimpleGroupDocsTest();

private void setLicense() {
try {
License license = new License();

System.out.println("1 License isValid: " + License.isValidLicense());

File licenseFile = new File(“FilesGroupDocs/GroupDocs.Viewer.lic”);

System.out.println("2 licenseFile.length(): " + licenseFile.length());

license.setLicense(new FileInputStream(licenseFile));

System.out.println("3 License isValid: " + License.isValidLicense());
} catch (Throwable throwable) {
System.out.println(“Can not verify Viewer license!”);


SimpleGroupDocs started :slight_smile:

1 License isValid: false
2 licenseFile.length(): 971
3 License isValid: false

Process finished with exit code 0


We have checked your provided source code and there is nothing wrong with it. The license gets applied successfully with the following output.

SimpleGroupDocs started :)
1 License isValid: false
2 licenseFile.length(): 998
3 License isValid: true

I would suggest you to please check if your license is valid for the version of the API you are using. For this, please check your Subscription Expiry Date which is also mentioned in the license file (see License.png). If this date is earlier than the release date of the API’s version being used then you will have to renew your subscription. You can check the release date of a particular version of the API in the downloads section.

In case the issue persists, please share with us your license file via private message (see how to send a private message). Furthermore, please also share with us the version of the API you are using.


Thanks for sharing additional information regarding the issue via private message. We have noticed that the license doesn’t apply when the locale is set to en-DE. Therefore, we have logged this behavior in our Issue Tracking System as VIEWERJAVA-1969. We shall look into this and get back to you as soon as we have any updates.


The issue you have faced earlier, logged as VIEWERJAVA-1969, has been fixed in this release.