phlux
phlux

Reputation: 33

Create standalone executable from Java code for Windows, OSX and Linux all at once

i'm coding a project in Java and building it with gradle. I need to keep it simple and compile it into standalone binaries for Windows, Mac and Linux.

Is there anything which can build all of this binaries or must i use a separate lib (like Launch4j for Windows executables) for every single binary?

I'd like to call a single "build-all-binarys"-like task in gradle and get a .exe, .app and .bin file out of it. It would be nice to have the possibility to bundle a JRE into the binary as well.

Upvotes: 1

Views: 765

Answers (1)

Mordechai
Mordechai

Reputation: 16294

Use the javapackager, added since Java 8 in the JDK.

It nicely creates a self contained executable - that's it bundles the JVM with every copy - of all standard operating systems with one call.

The javapackager is located in JAVA_HOME/bin/ directory.

Upvotes: 1

Related Questions