JAR安装程序,可自动检测Java是否存在并自动启动应用程序 [英] JAR installer that auto-detects if Java is there and autostarts the application

查看:144
本文介绍了JAR安装程序,可自动检测Java是否存在并自动启动应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要构建一个执行以下操作的安装程序:

I need to build an installer that does the following:


  1. 在客户端上安装我的jar。

  2. 自动检测是否安装了JRE(在这种情况下不会重新安装),否则安装它时无需用户点击其他按钮。

  3. 自动启动客户端启动时的应用程序。

  4. 适用于Windows,Mac和Linux。

  1. Installs my jar on the client.
  2. 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.
  3. Auto-starts the application when the client is booted.
  4. Works across Windows, Mac and Linux.

任何想法如何去做?

推荐答案

如果商业工具还可以,我可以推荐 install4j 。 1,2和4很容易用它做,但大约3我不确定。 编辑:您可以通过将您的应用程序安装为服务来实现这一点,install4j支持所有平台。引用其功能页面:

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完全支持
生成和安装服务
(守护进程)。对于服务,install4j

Windows上生成服务可执行文件,在Mac OS X上生成启动项,在Unix / Linux
平台上生成
启动/停止脚本。

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.

编辑:关于#2,JRE检测:install4具有非常好的,灵活的JRE捆绑/检测选项。您可以包含JRE(静态或动态,共享或不共享)或者更喜欢使用已存在的JRE,并可以从安装程序中下载JRE作为后备。请查看以下文档:安装程序如何查找JRE JRE Bundles

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.

更多关于我使用install4j的经验。)

对于其他工具,你可以查看一些早期的Java安装程序问题:

For other tools, you could check some of the earlier Java installer questions on SO:

  • What’s the best way to distribute Java applications?
  • Java Application Installers
  • What is the best installation tool for java?

这篇关于JAR安装程序,可自动检测Java是否存在并自动启动应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆