如果我有Java源文件(*.java)或类文件(*.class),如何将其转换为.exe文件?
我还需要一个安装程序。
如果我有Java源文件(*.java)或类文件(*.class),如何将其转换为.exe文件?
我还需要一个安装程序。
当前回答
我们正在使用Install4J为windows或unix环境构建安装程序。
它很容易定制,直到您想要为标准对话框无法完成的特殊操作编写脚本。但是即使我们用它来设置windows服务,我们也只是使用标准组件。
安装程序+启动程序 Windows或Unix Java脚本 ant任务 大量可定制的标准面板和操作 可选地包括或下载JRE 还能启动Windows服务吗 多种语言
我认为Launch4J来自同一家公司(只有启动器-没有安装程序)。
PS:很遗憾我没有得到这个代言的报酬。我只是喜欢那个工具。
其他回答
Java项目被导出为Jar可执行文件。当你想做一个java项目的。EXE文件,你可以做的是“转换”JAR到EXE(我说,我把引号之间转换,因为不是完全这样)。
从intelij你将只能生成罐子
尝试下面的例子:https://www.genuinecoder.com/convert-java-jar-to-exe/
或者,您可以使用一些java-to-c转换器(例如JCGO),并将生成的C文件编译为目标平台的本机二进制(.exe)文件。
您可以使用jar2exe将jar转换为exe。但是你需要购买软件。如果你需要一个开源软件,我会建议JSmooth。
你可以用下面的代码创建一个批处理文件:
start javaw -jar JarFile.jar
并使用任何。bat到。exe转换器将。bat转换为。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