DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Stop Writing Database Migration Scripts: Declarative Schema Sync for Java
  • Searching Kafka Without an Index: Lessons From Building Message Search for Kafdrop
  • ScyllaDB in Enterprise Java: High-Performance NoSQL With Eclipse JNoSQL
  • Member Spotlight: Shai Almong

Trending

  • The Window Closes: Why I Switched to Kotlin Before the Codebase Got Too Big
  • After the AI Commit: What Eight Retrospectives Taught Me About Working With Coding Agents
  • Multi-Agent Orchestration on AWS With AgentCore Runtime and A2A
  • Part 2: Securing and Scaling Goose-to-Java Agent Traffic With agentgateway

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Coding
  3. Java
  4. Make Your Own MSI (and RPM, DEB, and DMG) with JDK14

Make Your Own MSI (and RPM, DEB, and DMG) with JDK14

This article demonstrates one of the new features of Java 14, the ability to create native installer versions of a complete JDK.

By 
Jim Connors
·
Apr. 21, 20 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
6.3K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

Throughout much of its long history, Java Runtime Environments for MS-Windows have traditionally been packaged up in the venerable EXE format for installation.  This made for a well understood, straightforward and standard way of installing Java for individual users, unfortunately at the expense of those tasked with managing Windows systems en masse.  EXE files don't necessarily play well in the Windows systems administration world where tools like Microsoft SCCM and many other capable alternatives are used.  A more preferable payload is the MSI format.  The equivalents in the Linux and macOS world would be the RPM/DEB and DMG formats respectively.

To help rectify this shortcoming, some organizations have seen fit to produce their own MSI versions. Oracle, for example, provides an Enterprise MSI Installer for its Java SE Subscription customers with its Oracle JDK 7 and JDK 8 releases. Among the litany of Open JDK distributions, a few have also decided to package up their own MSI versions too.

JDK 14 marks the introduction of a formal incubator module called  jdk.incubator.jpackage , addressing the ability to package up Java applications in native format. The full extent of the tool is far beyond the scope of this article; one of the corner cases that the jpackage tool handles is the ability to simply create native installer (MSI, DEB, RPM, DMG) versions of a complete JDK.

Examples

Let's cut to the chase and show examples on two of the three major platforms.  For Windows, we'll use an Oracle JDK 14 instance located in the  D:\jdk-14  directory.  The following command will create a JDK 14 MSI file where the name and vendor has been specified via the  -n  and  --vendor  arguments:

Java
 




x


 
1
D:\>  jdk-14\bin\jpackage -n jdk-14-GA --type msi --vendor "Joe Schmo" --runtime-image jdk-14


There are additional directives that can be furnished to further customize the resulting package. Upon completion of the  jpackage  command, a file named  jdk-14-GA-1.0.msi  is created.  Once installed it appears in the Windows registry as follows:

File in the Windows registry

File in the Windows registry


In the Linux world, we'll use Oracle's OpenJDK 14 distribution. Two sample invocations follow, one to create a DEB package, the other to create an RPM:

Shell
 




xxxxxxxxxx
1


 
1
$ jdk-14/bin/jpackage -n openjdk-14-GA --type deb --vendor "Joe Debian" --runtime-image jdk-14


produces a file named  openjdk-14-ga_1.0-1_amd64.deb 

Shell
 




xxxxxxxxxx
1


 
1
$ jdk-14/bin/jpackage -n openjdk-14-GA --type rpm --vendor "Joe RedHat" --runtime-image jdk-14


produces a file named  openjdk-14-ga_1.0-1.x86_64.rpm 

On a Ubuntu system, the openjdk-14-ga_1.0-1_amd64.deb file can be installed and verified as shown by the screenshot that follows:

Verification of file

Verification of file


Conclusion

Two points are worth mentioning:

  • There is no notion of cross-building packages. That is to say, you must run jpackage on the same platform you wish to create a package for. Create Windows packages on Windows systems, Linux packages on Linux systems and MacOS packages on MacOS systems.
  • The Java Packaging Tool is in the incubator stage.  Incubator modules put technology in the hands of developers prior to finalization.  As such, expect further refinements to the jpackage  API as community feedback is solicited.
Deb (file format) Java (programming language)

Opinions expressed by DZone contributors are their own.

Related

  • Stop Writing Database Migration Scripts: Declarative Schema Sync for Java
  • Searching Kafka Without an Index: Lessons From Building Message Search for Kafdrop
  • ScyllaDB in Enterprise Java: High-Performance NoSQL With Eclipse JNoSQL
  • Member Spotlight: Shai Almong

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook