- Java 16 - Deprecation & Removals
- Java 16 - Other Changes
- Java 16 - Garbage Collectors
- Java 16 - Packaging Tools
- Java 16 - Record
- Java 16 - Warnings for Value-Based Classes
- Java 16 - Pattern Matching for instanceof
- Java 16 - Sealed Classes
- Java 16 - Environment Setup
- Java 16 - Overview
- Java 16 - Home
Java Other Versions Tutorials
- Java 15 Tutorial
- Java 14 Tutorial
- Java 13 Tutorial
- Java 12 Tutorial
- Java 11 Tutorial
- Java 10 Tutorial
- Java 9 Tutorial
- Java 8 Tutorial
- Java Tutorial
Java 16 Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Java 16 - Packaging Tools
Java 14 introduces a new packaging tool, jpackage based on javapackager. javapackager was introduced in Java 8 and was part of JavaFX kit. As JavaFX is sppt from Java from 11 version, this packaging tool is no more available in standard offering.
This new tool is developed to provide native installer for an operating system. For example, an msi/exe for windows, pkg/dmg for MacOS, deb/rpm for Linux and so on. Without this tool, developer generally share a jar file which a user has to run within own JVM.
Developer can use jpnk to compress the required JDK modules to minimum modules and use the jpackage to create a pghtweight image.
Consider the following example −
APITester.java
Example
pubpc class APITester { pubpc static void main(String[] args) { System.out.println("Welcome to TutorialsPoint."); } }
Compile and Run the program
$javac APITester.java $jar cf APITester.jar APITester.class
Output
For windows executable, you need to download
and add the toolkit to your path.Once jar is created and path is set, put jar in a folder called pb and run the following command to create a windows MSI installer.
$jpackage --input pb --name APITester --main-jar APITester.jar --main-class APITester --type msiAdvertisements