First of all: Native Image Kit is an implementation of GraalVM, the Java ahead of time compiler. The NIK from liberica is optimized for Swing and also JavaFX. That really makes sense while it is performant and - what all developers really want - you have a compiled and so not accessible Sourcecode. That makes it really interesting for use instead of some other languages.
The Native Image Kit has a few clues which I will show in a Tutorial within the next few days.
Advantage: really fast in Startup. Disadvantage compared to running tith JRE: the performance running with JRE is a bit higher (okay, discussion on a high level).
Java gives you three ways to distribute your applications. First of all the jar File. That is my favourite format when distributing my embedded applications. There is a jre installed on the system which I use. All my Customers getting Updates from time to time. With jar Files you have extremely small updates, big applications coming up with a few Megabytes, small ones with a few KB. But you need to be sure that the Customer has the right Java version installed. If your jar file was compiled with Java 22 for example it will not run on a Java JRE 11. The other way around a Java 11 compiled one will run on JDK 22. Important to know. Since I have the control for the installation situation on embedded Devices I know which JRE is installed and can compile my Apps with the right Java version.
The second way of Distribution is jpackage. Since Java 14 it is Part of the JDK. With JPackage you pack a distributable or even an installer with your Application and the needed runtime environment in one executable package. That is bigger than a jar File (mostly 30 to 50 MB more) but it includes the Java environment which you don’t install on the target computer. Weather a jre is installed or not on target computer or not: the application packed with JPackage is using only the one it is bundled with. So you have a rock solid bundle running on all your customers computers of the target platform. With Jpackage you need to pack your application for each target platform. I am doing this Job with Github Actions or even locally (I have a few customer requirements forbidding to use Github Actions cause of security reasons).
The third way is ahead of time compiling with GraalVM Native Image. This is an ahead of time compiling which compiles your Code in a secure und reliable way. There is one central problem doing this. Reflections and other operations which are dynamically generated in runtime. While compiling ahead of time we need to identify this functionalities to generate the dynamic parts also correct. Note that there can be also dynamic code generations which are leading to a partial JVM within the result (not often but it can be). This one would then run in background. You even don’t have to take care of it.
To use it the docs of Liberica are a good starting point while it describes all you need. Especially also the mave and gradle integration and (drum roll) the resources also have to be integrated.
In this document is the “magic” description to use it. Do not forget: when compiling Swing you need also to set the headless option like for AWT and yes, in Swing there is much stuff stolen from Java AWT.
To get the reflections and JNI which are not supported by GraalVM while dynamically generated use the tracing agent to get them out and generate the configuration files for the Compiler, described following the link at the end of the document I linked here:
https://docs.bell-sw.com/liberica-nik/23.1.3b1-21.0.3b10/how-to/using-nik-with-desktop-applications/
As I am using all three variants I have to describe why so people can understand:
simple jar I described. It could also be used for Desktop Apps but your customers would need to take care of the installed JRE/JDK on their client computers.
JPackage is the format I am using the most to distribute Desktop Applications. It comes with a slower startup but runs fast and reliable. For me so there would not be any need for NIK. It is extremely flexible and it is simple to use. You can pack all kinds of Apps starting from a Command Line application you can even use jpackage for Springboot applications, Java-Swing Desktop applications and JavaFX applications.
But I have customers which having strange security requirements. They could be handled with a clean configuration on all systems the Software will be installed. But. The complete compiled Code nobody can see, recompile or manipulate. That is a set of requirements coming up for military use in my case.
The further use is with GLUON Mobile for generating mobile apps for IOS and Android which is running and that’s it. Also the GLUON technology uses this System of GraalVM for compiling it. While IOS does not allow Java at all it is needed in this case. (Only other way for Java / mobile Apps is CodenameOne which is using ParparVM to bring the Java Code to Objective C which compiles directly to IOS Devices).
If there is after the provided lecture any need for explanations I can do that when I have time.
The used IDE: I have used all three ways of distribution ways (jar, jpackage and NIK) with Netbeans IDE, IntelliJIdea and with Eclipse. The examples I will porvide for Swing Apps will be always Netbeans while Netbeans has an integrated Swing Designer which makes it simple to redo that kind of stuffs (like my last description for Emile (JList Example)). But you could also hard code the GUI or even use the JFormdesigner made by Formdev which is avaiblabe as Plugin for IntelliJIdea, Eclipse and Netbeans. While it costs money I am always providing Netbeans. Small tip: if you change later from Netbeans UI Designer to JFormdesigner the JForm Deisgner will simply convert your Designs and you can work with them so it is possible to work with it with IntelliJ or Eclipse.
For JavaFX there is anyhow the Scenebuilder which is for free and works with all three IDE’s without any problem.
I hope I answered the questions you had.