H
H
Helo89892021-04-12 15:33:49
Java
Helo8989, 2021-04-12 15:33:49

How to create a windows executable jar or exe with a javafx application?

How to create a windows executable jar or exe, having a javafx application in IDEA? I did it through built, and then using launch4j, I also tried to launch it using a batch file of this kind - java -jar helloworld.jar . But
it doesn't start.
And I want to make it run on the client without unnecessary settings, only jre. Please tell me a proven way.?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey Gornostaev, 2021-04-12
@Helo8989

To make a java application ready to run on another machine without further ado, it is worth using the jlink utility included in the JDK . But this will not be a binary, but an assembly from the JRE and your application with launch scripts for different operating systems. You can make a binary using the native-image utility from the GraalVM kit, but this process is not easy and requires understanding the nuances of the compiler and the virtual machine.

S
Saboteur, 2021-04-12
@saboteur_kiev

Helo8989 ,
FINALLY something useful. It was necessary to immediately insert the text of the error into the question.
So in your screenshot (by the way, I could just run it from cmd and didn’t have to catch it, just copy the text):
(class file version 58.0), this version of Java Runtime only recognizes class file versions up to 54.0
Here is the table:
49 = Java 5
50 = Java 6
51 = Java 7
52 = Java 8
53 = Java 9
54 = Java 10
55 = Java 11
56 = Java 12
57 = Java 13
58 = Java 14
Therefore, the jar is compiled in java14, and you are trying to run it in JRE 10
Recompile your JAR with the appropriate java version (or lower)

O
Orkhan, 2021-04-12
Hasanly @azerphoenix

More recently, similar questions were asked:
What should I put in .jar or .bat files for autorun?
Is it possible to run a Java program without installing an integrated development environment?

D
Dmitry Roo, 2021-04-12
@xez

How to create a windows executable jar or exe

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question