Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Adding multi-jar and Jigsaw support to JPedal and JDeli

1 min read

jigsaw

One of the really exciting features added into Java 9 was the ability to have a multiple-jar release. This means that you can have a jar for Java 8, which also contains extra or different versions of classes which are used if a later version of Java is used. This feature was introduced in Java 9 in JEP-238. This makes it easier to try and support the most users (realistically Java 8) while allowing use of more modern features if a more modern Java version is available.

Adding multi-jar support needs a little bit of work in Java. I have found 2 approaches to doing it in Maven. Either you can recompile the Java11 code using AntRun (which is really nicely documented in this blog post) or you can have 2 Maven modules. Because we have a separate build module in JPedal for the shade plugin, we used the second approach in JPedal and AntRun in our JDeli build. There is also a really good article from Trisha Gee on creating multi-jars in IDEA.

At the moment, we are using this to add ONE additional file, module-info.java. This is another Java 9 feature (project Jigsaw) which allows users to make use of modularisation in their code. This allows us to lock the code down to the official API for JPedal/JDeli if you are using Java 9 or later. The module names are com.idrsolutions.jpedal and com.idrsolutions.jdeli for the module settings If you are using Java 8, nothing should change….

Going forward, this means while we support all Java releases 8 and above, we will be able to offer optimisations for the latest LTS (currently Java 11) and still provide complete support for an older version (currently Java 8). When we change the LTS, we will review this base release (which is likely to stay as Java 8 in the foreseeable future). Any changes will be announced well in advance on our blog as we did with the move to Java 8 and we will ask for customer feedback first.  We will also be looking into any areas of the code where we can gain substantial performance or memory advantages from having an optimised Java 11 version of the code for Java 11 users.

At the moment, we regard the inclusion of module-info as experimental so would welcome any feedback and ideas on this or any areas where Java 11 specific enhancements would be welcomed. What are your thoughts?

IDRsolutions develop a Java PDF Viewer and SDK, an Adobe forms to HTML5 forms converter, a PDF to HTML5 converter and a Java ImageIO replacement. On the blog our team post anything interesting they learn about.

Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

How to choose JPG versus JPEG2000 for image files

Since we started to support both JPG and JPG2000 as image file outputs in our software, we have found that this is a very...
Mark Stephens
1 min read

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2019. All rights reserved.