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

Free Support Forum - aspose.com

setLicense is very slow on linux,but it's fast on windows 10 by the same code

File file = new File("/ds/Aspose.Pdf.lic");
InputStream is = new FileInputStream(file);
License aposeLic = new License();

Linux Version
Red Hat Enterprise Linux Server release 6.5 (Santiago)

java Version
java version “1.8.0_51”
Java™ SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot™ 64-Bit Server VM (build 25.51-b03, mixed mode)


Thank you for contacting support.

Would you please ensure using Aspose.PDF for Java 19.6 and then mention how much time does setting the license takes in Linux environment. You may please calculate it with Java code that how many seconds are elapsed by setLicense method.

I am sure that it’s 19.6.it took 189553ms=189.553s=3.16min,it’s very slow.

the type of lic is Enterprise


the logs is
path Lic Start Time:1563936807554
path Lic End Time:1563936997107
Set PDF License Success…

Does the PDF jar have the one method, similar to the isLicenseSet() in the cell?

I use it in web-project,Is it true that after tomcat is started and lic is verified, the following code does not need to verifie lic when using PDF function?


Would you please try below code snippet in your environment and then share your observations about it.

java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy/MM/dd HH:mm:ss:SSS"); 
String dateStart = "";
String dateStop = "";
java.util.Date d1 = null;
java.util.Date d2 = null;

dateStart = sdf.format(new java.util.Date());

com.aspose.pdf.License licensePDF = new com.aspose.pdf.License();
dateStop = sdf.format(new java.util.Date());
d1 = sdf.parse(dateStart);
d2 = sdf.parse(dateStop);
long diff = d2.getTime() - d1.getTime();
long diffSeconds = diff / 1000 % 60;
long diffMinutes = diff / (60 * 1000) % 60;
System.out.println(diffMinutes + " mins, "+ diffSeconds + " secs.");

if (com.aspose.pdf.Document.isLicensed())
    System.out.println("License set successfully!");

The license should be set once per application context only, so you may set it when the application starts execution. Validating a license is not necessary but setting it is, because validation is a double check if license setting has been successful or not.

The time of runing your code is 3 mins, 16 secs.

The logs is
3 mins, 16 secs.
License set successfully!
Set PDF License Success…


This does not appear to be operating system related issue but probably your application specific problem. Would you please share a sample application containing SSCCE code so that we may proceed to investigate your scenario in our environment.

There were some changes in Aspose PDF 19.6 which is causing SecureRandom to use /dev/random for entropy but that’s not a great device to use for a headless environment. You can force the JVM to use /dev/urandom with a JVM argument:


I’m not sure if they plan on changing this but it’s a viable workaround for now. See this page for more info on java and SecureRandom performance.


Thank you for your worthy contribution.

This will probably help other community members with similar scenario. Whereas, we will be further investigating it.

@Jeker @snewby19

We have further investigated this ticket and would like to update you that, according to JVM securerandom algorithm, on some operating systems /dev/random waits for a certain amount of “noise” to be generated on the host machine before returning a result.

The library used for random number generation in Oracle’s JVM relies on /dev/random by default for UNIX platforms. Although /dev/random is more secure, it is recommended to use /dev/urandom if the default JVM configuration have delays. Or add devices that generate entropy for /dev/random by following steps:

  • Open the $JAVA_HOME/jre/lib/security/java.security file in a text editor.
  • Change the line “securerandom.source=file:/dev/random” to read: securerandom.source=file:/dev/./urandom
  • Save your change and exit the text editor.

You can also set up system property “java.security.egd” which will override the securerandom.source setting.


We will also be adding this information in a readme.txt file, inside zip archive with next release.

The issues you have found earlier (filed as PDFJAVA-38740) have been fixed in Aspose.PDF for Java 19.10.