本文介绍了从可运行的 jar(最好在 linux 上)创建 windows .exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序打包为 xyz.jar,它可以作为 java -Xmx2g -jar xyz.jar 运行

I have an application packaged up as a xyz.jar, which can be run as java -Xmx2g -jar xyz.jar

如何将其转换为 Windows 用户可以下载并单击启动的自包含 exe?最好,我希望 jre 也捆绑在 exe 中,就像可以从 mac 上完成一样:http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html

How can I convert this to a self-contained exe that can be downloaded by Windows users and launched with a single click? Preferably, I'd like the jre also bundled inside the exe, much like can be done from the mac: http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html

哦,如果我可以在 mac 或 linux 平台上从 ant 构建文件(或 eclipse 插件)执行此操作,我更喜欢,因为我无法轻松访问 Windows(尽管我的用户可以).这可能吗?谢谢.

Oh, and also I'd prefer if I can do this from an ant build file (or eclipse plugin) on a mac or linux platform, since I don't have easy access to Windows (though my users do). Is this possible?Thanks.

推荐答案

看看 Launch4J,它是跨平台的,因此您应该能够从您的构建运行的任何平台生成可执行文件.IIRC 它还有一个可以使用的 ANT 任务.

Take a look at Launch4J, it's cross platform so you should be able to generate the executable from any platform your build is running on. IIRC it also have an ANT task ready to be used.

http://launch4j.sourceforge.net/

这篇关于从可运行的 jar(最好在 linux 上)创建 windows .exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 07:13