eclipse 如何为 Java 程序创建 .msi 文件?(蚀)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4159737/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 15:19:02  来源:igfitidea点击:

How can I create a .msi file for a Java program ? (eclipse)

javaeclipsewindows-installer

提问by Rolan

I have a java project which I'm hoping to package and sell. How can I create a .msi file which will install my program on other windows computers? If there are any tutorials, please direct me to them. I'm also using Eclipse if that has any bearing on how to create the .msi file.

我有一个 Java 项目,希望将其打包并出售。如何创建将在其他 Windows 计算机上安装我的程序的 .msi 文件?如果有任何教程,请直接给我。如果这与如何创建 .msi 文件有任何关系,我也在使用 Eclipse。

Thanks

谢谢

采纳答案by Christopher Painter

There's nothing special about Java apps when it comes to creating MSI's other then you have to make sure you have a JVM/JRE installed just like you have to make sure the .NET framework is installed for .NET applications.

在创建 MSI 时,Java 应用程序没有什么特别之处,除此之外,您必须确保安装了 JVM/JRE,就像您必须确保为 .NET 应用程序安装了 .NET 框架一样。

Your question is too broad to be able to answer. Implicit in your question is "What tool should I use?" and once that's decided "How do I make an MSI using this tool?"

你的问题太广泛了,无法回答。您的问题中隐含的是“我应该使用什么工具?” 一旦决定“我如何使用此工具制作 MSI?”

For the first question, check out:

对于第一个问题,请查看:

Windows Installer Authoring Tools for Developers

面向开发人员的 Windows Installer 创作工具

回答by tefd

I've been using WiX extensively for creating MSI packages. It has quite a steep learning curve, but once you know what you're doing, it is very powerful. You said earlier that it needs Visual Studio installed, but I think it's just .NET 3.0, not the whole IDE.

我一直在广泛使用 WiX 来创建 MSI 包。它有一个相当陡峭的学习曲线,但是一旦你知道你在做什么,它就会非常强大。您之前说过它需要安装 Visual Studio,但我认为它只是 .NET 3.0,而不是整个 IDE。

I used this WiX tutorialwhen I got started, and it's got pretty much everything you need in there if you want to go down this route.

我在开始时使用了这个 WiX 教程,如果你想沿着这条路走下去,它里面几乎有你需要的一切。

If you're after something simple, search for a tool called WixEdit on SourceForge. This has a GUI for building MSIs - it's not perfect, but pretty easy to use and produces professional results.

如果您追求简单的东西,请在 SourceForge 上搜索名为 WixEdit 的工具。它有一个用于构建 MSI 的 GUI - 它并不完美,但非常易于使用并产生专业的结果。

I'll repeat, WiX has a very steep learning curve, and if you're just after a simple way to package your application, NSIS might be easier; or, you could use the standard IExpress.exe tool built into Windows to create a self-extracting .exe (but they don't "feel" as good as an MSI).

我再说一遍,WiX 有一个非常陡峭的学习曲线,如果你只是在寻找一种简单的方法来打包你的应用程序,NSIS 可能会更容易;或者,您可以使用 Windows 内置的标准 IExpress.exe 工具来创建自解压 .exe(但它们“感觉”不如 MSI)。

回答by limc

Use NSIS: http://nsis.sourceforge.net/Main_Page. It creates executable file that will do the same thing, and it is free.

使用 NSIS:http: //nsis.sourceforge.net/Main_Page。它创建可执行文件来做同样的事情,而且它是免费的。

回答by Ed.

If you specifically want to create an MSI package, and assuming you don't want to pay for something like InstallShield, look at Wix. http://wix.sourceforge.net/

如果您特别想创建一个 MSI 包,并假设您不想为 InstallShield 之类的东西付费,请查看 Wix。 http://wix.sourceforge.net/

回答by Daniel Gerson

I believe you want to look at Native Packaging, which according to this link was first introduced with JavaFX 2.2

我相信你想看看原生打包,根据这个链接,它首先是在 JavaFX 2.2 中引入的

https://netbeans.org/kb/docs/java/native_pkg.html

https://netbeans.org/kb/docs/java/native_pkg.html

Since it seems to be official Netbeans docs, I imagine it is sanctioned by Oracle. Here is the counterpart for Mac for interested readers.

由于它似乎是 Netbeans 的官方文档,我想它是由 Oracle 批准的。这是为感兴趣的读者提供的 Mac 对应版本。

http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html

http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html