java java桌面应用程序的自动启动?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/979451/
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
Auto startup for java desktop application?
提问by
I have created a desktop application in Java using NetBeans 6.1 and made a jar file of the application. Now I want to make it automatically start up whenever a client's machine boots up.
我使用 NetBeans 6.1 在 Java 中创建了一个桌面应用程序,并制作了该应用程序的 jar 文件。现在我想让它在客户端机器启动时自动启动。
How do I do that?
我怎么做?
回答by bluegene
There are many commercial installers which can do this http://www.advancedinstaller.com/jre-install.html
有许多商业安装程序可以做到这一点 http://www.advancedinstaller.com/jre-install.html
Are you looking for a free/OS one?
您在寻找免费的/操作系统吗?
Thanks Krishna
感谢克里希纳
回答by Roman Kagan
This installer can create a file with "msi" extension that will behave as regular windows installer. It bundles your jar file and JRE together into single file. The program acts as a "wizard", where you configure all necessary options.
此安装程序可以创建一个扩展名为“msi”的文件,该文件的行为与常规 Windows 安装程序相同。它将您的 jar 文件和 JRE 捆绑到一个文件中。该程序充当“向导”,您可以在其中配置所有必要的选项。
Take a look at this product:Advanced Installer
看看这个产品:高级安装程序
Good luck.
祝你好运。
回答by Huxi
If you simply want to have a java application autostarted in Windows you could just create a link in the users autostart folder calling javaw the same way you'd normally call java.
如果您只是想让一个 java 应用程序在 Windows 中自动启动,您可以在用户自动启动文件夹中创建一个链接,以与通常调用 javaw 相同的方式调用 javaw。
This is just meant FYI, the other suggestions are more general, of course, but this could be the simplest solution...
这只是仅供参考,其他建议当然更通用,但这可能是最简单的解决方案......
回答by Huxi
? works
? 作品
I have found the following order best suite to take a decision for commercial or free one, to fit your needs (most of the following does auto startup + extra features):
我找到了以下顺序的最佳套件来决定是商业版还是免费版,以满足您的需求(以下大部分都可以自动启动 + 额外功能):
Order show more features on top:
订单在顶部显示更多功能:
BitRock: see featuresi would really use this one, because it does all cross platform + Jnlp + Prerequisite
Tanukio: enter link description here
IzPack
Advancedinstaller: features
(optional) Jnlp web start: example(this should become future way of installing)
BitRock:查看功能我真的会使用这个,因为它可以跨平台 + Jnlp + 先决条件
Tanukio: 在此处输入链接描述
伊兹帕克
高级安装程序:功能
(可选)Jnlp web start:示例(这应该成为未来的安装方式)
Please note that, prerequisite is not mentioned, most of there feature list, which is very important to have in all of them, because many case we use third party libraries/dependencies, so the best question would be to know if they support it or not.
请注意,没有提到先决条件,其中大部分功能列表都非常重要,因为很多情况下我们使用第三方库/依赖项,所以最好的问题是知道他们是否支持它或不是。
回答by Jim Ferrans
Take a look at Tanuki's Java Service Wrapper. The Community version does what you need, plus a lot more.
看看 Tanuki 的Java Service Wrapper。社区版可以满足您的需求,而且还有更多功能。
If you only need to run a Java program periodically, I like pycron, which installs itself as a Windows service and then reads a Unix style crontab file where you would enter a line that tells pycron when it needs to run the java process (eg, every night at 3am).
如果您只需要定期运行 Java 程序,我喜欢pycron,它将自身安装为 Windows 服务,然后读取 Unix 样式的 crontab 文件,您将在其中输入一行告诉 pycron 何时需要运行 java 进程(例如,每晚凌晨 3 点)。

