简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM