Required Java Modules

Hello,

Owing to certain external factors out of my control, I need to change the JRE that is bundled with our app (purely for running the Aspose converters) from Oracle’s Java 7 to OpenJDK 10 or 11. With Java 7, I could follow Oracle’s advice on “Optional files and directory” to reduce the size of the JRE bundled with our app. With the most recent versions of the JDK, this is not possible. Instead, it seems that you need to use jlink to reduce the number of modules included and thus reduce the file size.

I would like only to include the Java files necessary for running Aspose.Words. A process of trial and error seems to show that the only modules Aspose.Words requires are java.base and java.desktop. Conversions to Word format still seem to work fine when I only include these, whereas if I omit java.desktop Aspose.Words will not run.

Could you please confirm that these are indeed the only modules I need to include? Is this documented somewhere?

Many thanks,
Keith

@kayembi,

We have logged your requirement in our issue tracking system. Your ticket number is WORDSNET-17602 . We will further look into the details of this requirement and will keep you updated on the status of the linked issue.

Great, many thanks. I assume that means that you don’t know off-hand which modules are required, then? I’ve ran a few extra tests now including only java.base and java.desktop and everything seems to be running fine, so fingers crossed that’s enough.

All the best,
Keith

@kayembi,

It is great that you were able to resolve this issue on your end. We have also logged your comment in our issue tracking system. We will keep you posted on any further updates.

If there’s any further advice you could give on this, I would greatly appreciate it. We released a build of our app with Java set up (via jlink) only to include java.base and java.desktop, but we received bug reports from users that non-English characters were not being exported correctly to Word. Testing this, I could reproduce it - Chinese or Korean characters end up as boxes when exported to Word.

Looking through the available Java modules (using java --list-modules), I decided to try adding jdk.charsets - this solved the issue.

Looking into this some more, I used jdeps on the Aspose .jar file. The jdeps tool lists the following module dependencies for Aspose:

java.base
java.desktop
java.logging
java.sql
java.sql.rowset
java.xml

Strangely, it doesn’t list jdk.charsets, though, which I have found is necessary for non-English files.

So, I am now using jlink to incorporate the following Java modules:

java.base
java.desktop
java.logging
java.sql
java.sql.rowset
java.xml
jdk.charsets

All of this, of course, is to ensure that I am bundling only a minimal version of Java with my app - an 80MB runtime rather than the full 330MB JDK.

I’d be very grateful if you could let me know which other modules I should include in order for Aspose to run without issue.

Many thanks,
Keith

@kayembi,

Thanks for the additional information. We have logged your comment in our issue tracking system. We will keep you posted on any further updates.

@kayembi,

It is to update you that we use the same list as you shared in your previous post plus the “java.xml.crypto” package. Hope, this helps.

Great, many thanks! That helps a lot.

All the best,
Keith

The issues you have found earlier (filed as WORDSJAVA-1928) have been fixed in this Aspose.Words for .NET 19.1 update and this Aspose.Words for Java 19.1 update.