I need to build an installer that does the following:
我需要构建一个执行以下操作的安装程序:
- Installs my jar on the client.
- Auto-detects if JRE is installed (in which case it does not re-install it), otherwise installs it without the user clicking on another button.
- Auto-starts the application when the client is booted.
- Works across Windows, Mac and Linux.
在客户端上安装我的jar。
自动检测是否安装了JRE(在这种情况下它不会重新安装),否则安装它而无需用户单击另一个按钮。
引导客户端时自动启动应用程序。
适用于Windows,Mac和Linux。
Any idea how to go about it?
知道如何去做吗?
6 个解决方案
#1
If a commercial tool is ok, I can recommend install4j. 1, 2 and 4 are easy to do with it, but about 3 I'm not sure. Edit: You could probably achieve that by installing your app as a "service", which install4j supports for all platforms. Quoting from its Features page:
如果商业工具还可以,我可以推荐install4j。 1,2和4很容易用它做,但大约3我不确定。编辑:您可以通过将您的应用程序安装为“服务”来实现这一点,install4j支持所有平台。从其功能页面引用:
install4j offers full support for generating and installing services (daemons). For services, install4j generates service executables on Windows, startup items on Mac OS X and start/stop scripts on Unix/Linux platforms.
install4j提供对生成和安装服务(守护进程)的完全支持。对于服务,install4j在Windows上生成服务可执行文件,在Mac OS X上生成启动项,在Unix / Linux平台上生成/停止脚本。
Edit: Regarding #2, JRE detection: install4 has pretty nice, flexible options for JRE bundling/detecting. You can include a JRE (statically or dynamically, shared or not) or prefer to use one already present, with the possibility to download a JRE from within your installer as a fallback. Check these docs for more: How Installers Find a JRE and JRE Bundles.
编辑:关于#2,JRE检测:install4具有非常好的,灵活的JRE捆绑/检测选项。您可以包含JRE(静态或动态,共享或不共享)或者更喜欢使用已存在的JRE,并可以从安装程序中下载JRE作为后备。请查看这些文档以获取更多信息:安装程序如何查找JRE和JRE软件包。
(More about my experiences with install4j.)
(更多关于我对install4j的体验。)
For other tools, you could check some of the earlier Java installer questions on SO:
对于其他工具,您可以在SO上查看一些早期的Java安装程序问题:
- What’s the best way to distribute Java applications?
- Java Application Installers
- What is the best installation tool for java?
分发Java应用程序的最佳方式是什么?
Java应用程序安装程序
什么是最好的java安装工具?
#2
Commercial tools like InstallAnywhere can do that. After installing the JAR (and links and such), installers can check the registry if Java is already installed and proceed or not. As long as the installer supports all needed plattforms, you are fine.
像InstallAnywhere这样的商业工具可以做到这一点。安装JAR(以及链接等)之后,安装程序可以检查注册表是否已安装Java并继续。只要安装程序支持所有需要的平台,您就可以了。
#3
You could use launch4j , it does not automatically install java however. But maybe there's a way to make that work by packaging the JRE for example.
您可以使用launch4j,但它不会自动安装java。但也许有一种方法可以通过打包JRE来实现这一目标。
#4
You may also want to take a look at BitRock InstallBuilder, it provides built-in functionality to perform what you want. We will be happy to build a sample installer for you, just drop us a line.
您可能还想查看BitRock InstallBuilder,它提供了内置功能来执行您想要的操作。我们很乐意为您构建一个示例安装程序,请给我们留言。
#5
I recommend downloading the source code for the build scripts of popular Java programs like limewire and follow their example. The end.
我建议下载像limewire这样的流行Java程序的构建脚本的源代码,并按照他们的例子。结束。
...Or you can do like I did:
......或者你可以像我一样做:
- I have done the JRE detection and download/install of redistributable if required with NSIS on Windows. Maybe an .msi is better than a installer.exe which NSIS creates. I believe msi are more like packages on mac so they allow proper updates. Maybe NSIS creates MSIs... not sure.
- Mac is simply an Java App bundle and you specify the JRE and other Java info in the info.plist and you can optionally create a .pkg file to give the user an installer and bundle up in a dmg using the command line dmg programs.
- I haven't done Linux and don't plan to... sorry :)
如果Windows上的NSIS需要,我已经完成了JRE检测和可再发行的下载/安装。也许.msi比NSIS创建的installer.exe更好。我相信msi更像是mac上的软件包,所以它们允许适当的更新。也许NSIS会创建MSI ......不确定。
Mac只是一个Java App捆绑包,您可以在info.plist中指定JRE和其他Java信息,您可以选择创建.pkg文件,为用户提供安装程序,并使用命令行dmg程序以dmg捆绑。
我还没有做过Linux,也不打算...抱歉:)
All this was a fair chunk of work. I first did the Windows stuff then a couple years later did the Mac stuff.
所有这些都是相当大的工作。我第一次做Windows的东西,然后几年后做了Mac的东西。
You can integrate all of this in NSIS build scripts and Ant. I can't remember why I didn't use install4j. Probably I was too cheap :)
您可以在NSIS构建脚本和Ant中集成所有这些。我不记得为什么我没有使用install4j。可能我太便宜了:)
#6
Haven't heard of anything that works across all those platforms, but JSmooth might help (fits your needs on Windows). I've used it about 2 years ago and it worked fine.
没有听说任何适用于所有这些平台的东西,但JSmooth可能会有所帮助(适合您在Windows上的需求)。大约2年前我用过它,效果很好。
#1
If a commercial tool is ok, I can recommend install4j. 1, 2 and 4 are easy to do with it, but about 3 I'm not sure. Edit: You could probably achieve that by installing your app as a "service", which install4j supports for all platforms. Quoting from its Features page:
如果商业工具还可以,我可以推荐install4j。 1,2和4很容易用它做,但大约3我不确定。编辑:您可以通过将您的应用程序安装为“服务”来实现这一点,install4j支持所有平台。从其功能页面引用:
install4j offers full support for generating and installing services (daemons). For services, install4j generates service executables on Windows, startup items on Mac OS X and start/stop scripts on Unix/Linux platforms.
install4j提供对生成和安装服务(守护进程)的完全支持。对于服务,install4j在Windows上生成服务可执行文件,在Mac OS X上生成启动项,在Unix / Linux平台上生成/停止脚本。
Edit: Regarding #2, JRE detection: install4 has pretty nice, flexible options for JRE bundling/detecting. You can include a JRE (statically or dynamically, shared or not) or prefer to use one already present, with the possibility to download a JRE from within your installer as a fallback. Check these docs for more: How Installers Find a JRE and JRE Bundles.
编辑:关于#2,JRE检测:install4具有非常好的,灵活的JRE捆绑/检测选项。您可以包含JRE(静态或动态,共享或不共享)或者更喜欢使用已存在的JRE,并可以从安装程序中下载JRE作为后备。请查看这些文档以获取更多信息:安装程序如何查找JRE和JRE软件包。
(More about my experiences with install4j.)
(更多关于我对install4j的体验。)
For other tools, you could check some of the earlier Java installer questions on SO:
对于其他工具,您可以在SO上查看一些早期的Java安装程序问题:
- What’s the best way to distribute Java applications?
- Java Application Installers
- What is the best installation tool for java?
分发Java应用程序的最佳方式是什么?
Java应用程序安装程序
什么是最好的java安装工具?
#2
Commercial tools like InstallAnywhere can do that. After installing the JAR (and links and such), installers can check the registry if Java is already installed and proceed or not. As long as the installer supports all needed plattforms, you are fine.
像InstallAnywhere这样的商业工具可以做到这一点。安装JAR(以及链接等)之后,安装程序可以检查注册表是否已安装Java并继续。只要安装程序支持所有需要的平台,您就可以了。
#3
You could use launch4j , it does not automatically install java however. But maybe there's a way to make that work by packaging the JRE for example.
您可以使用launch4j,但它不会自动安装java。但也许有一种方法可以通过打包JRE来实现这一目标。
#4
You may also want to take a look at BitRock InstallBuilder, it provides built-in functionality to perform what you want. We will be happy to build a sample installer for you, just drop us a line.
您可能还想查看BitRock InstallBuilder,它提供了内置功能来执行您想要的操作。我们很乐意为您构建一个示例安装程序,请给我们留言。
#5
I recommend downloading the source code for the build scripts of popular Java programs like limewire and follow their example. The end.
我建议下载像limewire这样的流行Java程序的构建脚本的源代码,并按照他们的例子。结束。
...Or you can do like I did:
......或者你可以像我一样做:
- I have done the JRE detection and download/install of redistributable if required with NSIS on Windows. Maybe an .msi is better than a installer.exe which NSIS creates. I believe msi are more like packages on mac so they allow proper updates. Maybe NSIS creates MSIs... not sure.
- Mac is simply an Java App bundle and you specify the JRE and other Java info in the info.plist and you can optionally create a .pkg file to give the user an installer and bundle up in a dmg using the command line dmg programs.
- I haven't done Linux and don't plan to... sorry :)
如果Windows上的NSIS需要,我已经完成了JRE检测和可再发行的下载/安装。也许.msi比NSIS创建的installer.exe更好。我相信msi更像是mac上的软件包,所以它们允许适当的更新。也许NSIS会创建MSI ......不确定。
Mac只是一个Java App捆绑包,您可以在info.plist中指定JRE和其他Java信息,您可以选择创建.pkg文件,为用户提供安装程序,并使用命令行dmg程序以dmg捆绑。
我还没有做过Linux,也不打算...抱歉:)
All this was a fair chunk of work. I first did the Windows stuff then a couple years later did the Mac stuff.
所有这些都是相当大的工作。我第一次做Windows的东西,然后几年后做了Mac的东西。
You can integrate all of this in NSIS build scripts and Ant. I can't remember why I didn't use install4j. Probably I was too cheap :)
您可以在NSIS构建脚本和Ant中集成所有这些。我不记得为什么我没有使用install4j。可能我太便宜了:)
#6
Haven't heard of anything that works across all those platforms, but JSmooth might help (fits your needs on Windows). I've used it about 2 years ago and it worked fine.
没有听说任何适用于所有这些平台的东西,但JSmooth可能会有所帮助(适合您在Windows上的需求)。大约2年前我用过它,效果很好。