Java 打包工具 - jsmooth、launch4j、onejar 的替代品
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1967549/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java packaging tools - alternatives for jsmooth, launch4j, onejar
提问by Edgar
I have used these three open source tools for packaging my java apps, but they all look like abandon-ware now. All three are very good pieces of software. What are the options now? (or is using Java for desktop app development no longer a "hot" market for app developers to build & maintain these tools?).
我已经使用这三个开源工具来打包我的 Java 应用程序,但它们现在看起来都像是废弃的软件。这三个都是非常好的软件。现在有哪些选择?(或者是否使用 Java 进行桌面应用程序开发不再是应用程序开发人员构建和维护这些工具的“热门”市场?)。
1) exe wrapper: jsmooth - no new development in 2.5 years - does not support 64 bit. launch4j - no new development in over a year, supports 64 bit, but you can't sign the exe created by launch4j, so I prefer jsmooth, but it does not support 64 bit.
1) exe 包装器:jsmooth - 2.5 年没有新开发 - 不支持 64 位。launch4j - 一年多没有新开发了,支持64位,但是不能对launch4j创建的exe签名,所以我更喜欢jsmooth,但是不支持64位。
2) onejar: It works, but there has been no new development or web site update in more than 2.5 years. So, just want to switch to something that's supported / have a backup plan if it suddenly breaks with a new build of Java.
2)onejar:可以用,但是2.5年多没有新的开发或网站更新了。因此,如果新版本的 Java 突然中断,只想切换到支持的内容/有备份计划。
Thanks Edgar
谢谢埃德加
回答by Brian Clapper
Have you tried IzPack (http://izpack.org/)?
您是否尝试过 IzPack ( http://izpack.org/)?
回答by Pascal Thivent
Did you check IzPack? This is a great piece of software to create cross-platform installers:
你检查过IzPack吗?这是创建跨平台安装程序的绝佳软件:
IzPack is an installers generator for the Java platform. It produces lightweight installers that can be run on any operating system where a Java virtual machine is available. Depending on the operating system, it can be launched by a double-click or a simple 'java -jar installer.jar' on a shell. The most common use is to distribute applications for the Java platform, but you can also use it for other kinds of projects. The main benefit of IzPack is that it provides a clean and unique way of distributing a project to users using different operating systems.
IzPack 是 Java 平台的安装程序生成器。它生成轻量级安装程序,可以在任何可以使用 Java 虚拟机的操作系统上运行。根据操作系统的不同,它可以通过双击或 shell 上的简单“java -jar installer.jar”启动。最常见的用途是为 Java 平台分发应用程序,但您也可以将其用于其他类型的项目。IzPack 的主要好处是它提供了一种干净且独特的方式来将项目分发给使用不同操作系统的用户。
Some really famous companies and projects use it for many years (Sun Microsystems, JBoss/RedHat, the Scala language project, some ObjectWeb/OW2 projects, XWiki and many more). If it's good for them, it should be good for you :)
一些非常著名的公司和项目使用它多年(Sun Microsystems、JBoss/RedHat、Scala 语言项目、一些 ObjectWeb/OW2 项目、XWiki 等等)。如果这对他们有好处,那应该对你有好处:)
回答by Paul Keeble
Maven 2 provides the ability to create a jar which contains all the dependencies as part of its assembly plugin. This combined with the jar plugin configuration of the manifest file (and specifically setting Main-class to the Class with main) is all you need to do basic packaging.
Maven 2 提供了创建 jar 的能力,该 jar 包含作为其程序集插件的一部分的所有依赖项。这与清单文件的 jar 插件配置(特别是将 Main-class 设置为带有 main 的 Class)相结合,是您进行基本打包所需的全部内容。
To some extent Java web start is now considered the better way to distribute Java applications and Maven 2's assembly capability combined with web start gets you everything you need without going via the exe route.
在某种程度上,Java web start 现在被认为是分发 Java 应用程序的更好方法,而 Maven 2 的组装能力与 web start 相结合,无需通过 exe 路径即可为您提供所需的一切。
回答by steve
If you just want an exe (instead of a full-blown installer) you can make one with NSIS: http://nsis.sourceforge.net/Java_Launcher_with_automatic_JRE_installation
如果你只想要一个 exe(而不是一个完整的安装程序),你可以用 NSIS 制作一个:http: //nsis.sourceforge.net/Java_Launcher_with_automatic_JRE_installation
Yes, NSIS is an installer but you can have it just run a jar in the same directory by stripping out all of the installer stuff. Basically it works like launch4j but is a lot more configurable.
是的,NSIS 是一个安装程序,但您可以通过删除所有安装程序的内容,让它在同一目录中运行一个 jar。基本上它像launch4j一样工作,但更可配置。
回答by Paul Taylor
Launch4j has just been updated ! http://launch4j.sourceforge.net/changelog.html
Launch4j 刚刚更新!http://launch4j.sourceforge.net/changelog.html
回答by Michael
You can try
你可以试试
http://winrun4j.sourceforge.net/
http://winrun4j.sourceforge.net/
Has an exe with 64bit support and is quite easy to configure with an ini file.
有一个支持 64 位的 exe,并且很容易使用 ini 文件进行配置。
回答by akauppi
Since none of the answers were approved, and JavaFX 2.2 has not been mentioned above (was not available at the time of the answers) here goes:
由于没有一个答案被批准,并且上面没有提到 JavaFX 2.2(在答案时不可用),这里是:
JavaFX 2.2 (part of Java Runtime and SDK since 7u6) allows building native exe/dmg/rpm's that tag along the full RT component as well. I believe this is a valid answer to your need, as well as an officially supported solution from Oracle.
JavaFX 2.2(自 7u6 起成为 Java 运行时和 SDK 的一部分)也允许沿完整 RT 组件构建本机 exe/dmg/rpm 标记。我相信这是满足您需求的有效答案,也是 Oracle 官方支持的解决方案。
https://blogs.oracle.com/talkingjavadeployment/entry/native_packaging_for_javafx
https://blogs.oracle.com/talkingjavadeployment/entry/native_packaging_for_javafx
回答by gouessej
As I was fed up with recent security changes in Java Webstart, I created my own tool, JNDT. It's under GPL.
由于我厌倦了 Java Webstart 中最近的安全更改,因此我创建了自己的工具JNDT。它在 GPL 下。
It goes farther than akauppi's suggestion because it allows to create GNU Linux packages even under Mac and Windows :) I use it to create Mac bundle under GNU Linux too. For the moment, it's just a single Ant library with a few dependencies that allows to create native self-contained application bundles for GNU Linux, Mac OS X and Windows. I use it for my first person shooter and I'm very happy with it. It bundles the JRE but it can use the system JRE if you want.
它比 akauppi 的建议更进一步,因为它甚至允许在 Mac 和 Windows 下创建 GNU Linux 包:) 我也用它在 GNU Linux 下创建 Mac 包。目前,它只是一个带有一些依赖项的 Ant 库,允许为 GNU Linux、Mac OS X 和 Windows 创建本机自包含应用程序包。我将它用于我的第一人称射击游戏,我对此非常满意。它捆绑了 JRE,但如果需要,它可以使用系统 JRE。
P.S: JNDT is able to create a native Windows installer as an executable with NSIS even under GNU Linux.
PS:即使在 GNU Linux 下,JNDT 也能够使用 NSIS 创建本机 Windows 安装程序作为可执行文件。
I understand that the GPL license discourages some developers to use my tool. In this case, rather use PackR.
我了解 GPL 许可证不鼓励某些开发人员使用我的工具。在这种情况下,而是使用PackR。
回答by Umi
If you are using gradle, there is a plugin that uses launch4j (under the hood) and works great. It doesn't even require you to download or install launch4j, it is totally automated.
如果您使用的是 gradle,则有一个插件使用 launch4j(在后台)并且效果很好。它甚至不需要您下载或安装launch4j,它是完全自动化的。