如果我有Java源文件(*.java)或类文件(*.class),如何将其转换为.exe文件?
我还需要一个安装程序。
如果我有Java源文件(*.java)或类文件(*.class),如何将其转换为.exe文件?
我还需要一个安装程序。
当前回答
如果您需要将整个应用程序转换为本机代码,即EXE加dll,有ExcelsiorJET。我发现它工作得很好,并提供了捆绑JRE的替代方案。
编辑:这是在2010年发布的-该产品已不再可用。
其他回答
以我之见,JSmooth似乎做得相当不错。
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
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在本地部署应用程序”的模式。
我们正在使用Install4J为windows或unix环境构建安装程序。
它很容易定制,直到您想要为标准对话框无法完成的特殊操作编写脚本。但是即使我们用它来设置windows服务,我们也只是使用标准组件。
安装程序+启动程序 Windows或Unix Java脚本 ant任务 大量可定制的标准面板和操作 可选地包括或下载JRE 还能启动Windows服务吗 多种语言
我认为Launch4J来自同一家公司(只有启动器-没有安装程序)。
PS:很遗憾我没有得到这个代言的报酬。我只是喜欢那个工具。