0

The Title is probably worded weirdly.

I've been using Jarsplice to convert my Jar files into Exes and they're able to run properly. But when I try to run the exes on different computers it would say that Java is required to run the program. So I just wanted to know if anyone knows how to and what can convert jar files into exes without java being necessary to install on other devices.

  • 2
    You need to look at the, many, possible options which are available for creating an exe from a Jar/java project and see which ones allow you to embedded the JRE (this will EXPLODE the size of the resulting exe). Alternatively, you could bundle the JRE along side the exe, again, you'll need to check which products will allow you to specify the JRE path to be used. I did (the second one) years ago, but we also had a installer to do all that nice heavy lifting. And, no I don't recall any "java to native binary" converter (that at least actually worked) – MadProgrammer Jan 18 '22 at 23:52
  • 1
    For [example](https://stackoverflow.com/questions/13996547/how-do-i-bundle-a-jre-into-an-exe-for-a-java-application-launch4j-says-runtime), [might be interesting](https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html), [is a little dated, but](https://robbamforth.wordpress.com/2016/01/29/java-how-to-bundle-a-java-app-as-an-windows-executable-exe-jar-to-exe-6/) – MadProgrammer Jan 18 '22 at 23:55
  • You may want to learn about [jlink](https://openjdk.java.net/jeps/282) and [jpackage](https://openjdk.java.net/jeps/392). – Basil Bourque Jan 18 '22 at 23:58
  • You may find https://stackoverflow.com/questions/53453212/how-to-deploy-a-javafx-11-desktop-application-with-a-jre helpful. – VGR Jan 19 '22 at 03:59

1 Answers1

0

You can also use GraalVM. This brings an app called native-image, which you can run like this:

"D:\apps\graalvm\graalvm-ce-java11-21.0.0.2\bin\native-image" -cp "D:\workspace\HelloWold\bin2" Main "D:\workspace\HelloWold\release\HelloWold"

And which will output a standalone .exe file.

JayC667
  • 2,418
  • 2
  • 17
  • 31