Creating a windows .exe from a runnable jar (preferably on linux)

你离开我真会死。 提交于 2019-12-11 06:56:55

问题


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

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

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.


回答1:


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/



来源:https://stackoverflow.com/questions/22263940/creating-a-windows-exe-from-a-runnable-jar-preferably-on-linux

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