How to create native binaries for your Java app? [duplicate]

馋奶兔 提交于 2019-11-28 21:58:19

To make a native binary for Windows, you would use a tool like Launch4J. On OSX you could use JarBundler. Minecraft simply distributes the jar file for Linux. I'm not aware of a native binary packager for Linux.

You could also compile your Java code via GCJ but that's probably not what you want, as there are limitations and compatibility concerns there. The native bundlers like Launch4j and JarBundler simply wrap your jar file and use a real JRE to execute it.

As for integrating with NetBeans or Eclipse, you'll probably have to write your own ant build file, especially since the solution varies from one platform to the next.

If you are using Java 9, you can also use Java 9 Modularization & jlink to ship a zero-dependency native app.

There is also maven-jlink-plugin that could help here.

Take a look at GCJBuilder plugin for eclipse. Not sure if it supports cross compilation as the command GCJ compiler does.

Andrew Thompson

If the app. has a GUI and can be distributed from a web site, look into Java Web Start. JWS is supplied by Oracle, and provides auto-update amongst many other features.

Note that JWS uses Jar files, so no conversion is necessary.

I've used JSMooth for this in the past: http://jsmooth.sourceforge.net/ As mentioned before, this wrapper just looks for a real JRE to run it - it does not come with a bundled JRE.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!