java – Is it possible how to make the jar file run on computers without JRE installed? Maybe somehow introduce it inside?

Question:

There is a Javafx application, it runs there, of course, where there is jre. Is it possible how to make the jar file run on computers without JRE installed? Maybe somehow introduce it inside?

Answer:

If you are working in IntellijIDEA, you can use the built-in offline file generation mechanism

  • Craft an artifact:

File -> Project Structure -> Project Settinfs -> Artifacts -> + -> javaFX Application -> From module 'Your Module Name'

On the right in the JavaFX tab, set:
Application Class: your class with an entry point – the main method
Native Bondle: All

Check that the Output directory set correctly (by default to the out\artifacts folder of your project)

  • Shoot down the artifact:

Build -> Build Artifacts -> 'Your artifact' -> Build

A directory with ваш артефакт.exe executable file and the required execution environment will appear in out/artifacts/ .

Having copied the folder to another computer, you can run the project without the JRE installed, since everything you need is in the same folder with the executable file.

Scroll to Top