Deploying Java in Standalone Packages and Containers
In this last chapter, we will look at different ways to package and distribute a Java application. We have already seen JAR files for desktop applications and WAR files for web applications, along with how to deploy them. While this approach can be sufficient for deployment, there are situations where this traditional approach can be improved upon.
Java is big. There are numerous libraries in the Java SE distribution, although it is likely that your application only needs some of them. The same can be said for third-party or external libraries. Modern packaging using the Java module approach allows you to produce JAR or WAR files that only contain parts of a library that you will use.
In the case of web applications, this type of packaging can reduce the size of a WAR file to contain only the required modules from a required external library, rather than the entire library. In the case of desktop applications, it is required...