如果我有Java源文件(*.java)或类文件(*.class),如何将其转换为.exe文件?
我还需要一个安装程序。
如果我有Java源文件(*.java)或类文件(*.class),如何将其转换为.exe文件?
我还需要一个安装程序。
当前回答
I would say launch4j is the best tool for converting a java source code(.java) to .exe file You can even bundle a jre with it for distribution and the exe can even be iconified. Although the size of application increases, it makes sure that the application will work perfectly even if the user does not have a jre installed. It also makes sure that you are able to provide the specific jre required for your app without the user having to install it separately. But unfortunately, java loses its importance. Its multi platform support is totally ignored and the final app is only supported for windows. But that is not a big deal, if you are catering only to windows users.
其他回答
最新的Java Web Start已得到增强,以支持良好的脱机操作以及“本地安装”。这是值得研究的。
EDIT 2018: Java Web Start不再与最新的JDK绑定。甲骨文正在推动一种“使用封闭的JRE在本地部署应用程序”的模式。
以我之见,JSmooth似乎做得相当不错。
你可以用Janel。最后一个是作为应用程序启动器或服务启动器(可从4.x获得)。
或者,您可以使用一些java-to-c转换器(例如JCGO),并将生成的C文件编译为目标平台的本机二进制(.exe)文件。
Launch4j
Launch4j is a cross-platform tool for wrapping Java applications distributed as jars in lightweight Windows native executables. The executable can be configured to search for a certain JRE version or use a bundled one, and it's possible to set runtime options, like the initial/max heap size. The wrapper also provides better user experience through an application icon, a native pre-JRE splash screen, a custom process name, and a Java download page in case the appropriate JRE cannot be found. – Launch4j's website