Answer the question
In order to leave comments, you need to log in
Is there any guide on how to compile java files into a binary?
Is there any way to create an executable file from java files and still not ask the user to resume something after installation (let's say he does not have a JVM on the PC). If there is a detailed guide on how to make such an exe, please share it.
Answer the question
In order to leave comments, you need to log in
You can use jlink to create a distribution version of the program that includes the JRE. This is a standard, officially recommended approach, but you get not one exe's, but a directory with many files and a bat's nickname to run the program.
A real exe can be made using the native-image utility included in Graal, but not all java programs are suitable for this.
You won’t be able to make a binary by itself, Java needs a JVM, but you can do a little trick and prepare pseudo-binaries for different OSes using plugins for Maven. Often, ease of launch is important for the user, and not “exactly a binary” (although there was one such case with one Python utility and I had to rewrite it in Golang, since the latter allows you to make exactly a binary).
If you make an application in the form of Spring Boot, then you can make a hodgepodge for different OS using Maven:
- use the launch4j-maven-plugin plugin to make an exe bundle version for Windows
- use the appbundle-maven-plugin plugin to make an app image for Mac OS
- with using Spring Boot plugin to make SH executable for Linux
all of the above will use the installed Java on the user's wheelbarrow, as an example - a utility for broadcasting videos to Kodi
if you want to get rid of the installed JDK, then using jlink (for example, through the mvn-jlink plugin in maven) make cross-platform images and pack with the application , for example, this is what the SciaReto project does
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question