Issue
I'm looking for a way to build my Java or JavaFx apps so that I have a single executable file that runs without installing a Java runtime on the target system that is running Linux (like a .exe on Windows)
Usually, Java apps are packaged into jar files that can be run like this
java -jar <file-name>.jar
This requires us to install a Java JRE beforehand.
I'm looking for a solution to package my Java app so that it can execute without needing a Java JRE on the target machine.
Solution
as @Slaw mentioned in a comment for java 14+ this is the best solution
it uses the jlink
command internally
and supports Mac, Windows, and Linux
The official Java-based solution is mentioned above but its highly recommended to use GraalVM in case you want extra performance and a better approach for microservices
installation steps are mentioned below in @Kevin Hooke's answer
I think ```jlink``` is useable with older Java versions too
if anyone has experience with jlink
on older versions please comment below
Answered By - Farhad