如何启动 java-web-start 应用程序并等待其退出?
我刚刚发现 javaws -wait 没有执行 Windows 上应该执行的操作。它将在应用程序完成之前返回。
这个 bug 已经存在 5 年多了,并且已关闭,无法修复 6281477,所以我们需要一个解决方法。
我正在寻找一个干净的解决方案,它将:
- 无人值守运行(无用户干预):
- 目前,如果 JNLP 文件无法访问,Java 将显示错误窗口。
- 如果应用程序因任何原因失败,我们需要一个不同于 0 的返回码。
最好为该 Java 或 Python 提供跨平台解决方案,但即使是 Windows 批处理解决方案也是可以接受的。
I just found out that javaws -wait
doesn't do what is supposed to do on Windows. It will return before the aplication finishes.
This bug is more than 5 years old and closed as won't fix
6281477, so we need a workaround.
I looking for a clean solution that will:
- run unattended (no user intervention):
- currently if JNLP file is not accessible, Java will display an error window.
- if application fails for any reason we need a return code different from 0
It would be preferable to have a cross platform solution for this Java or Python but it would be acceptable even a Windows batch solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您不需要从网络启动应用程序(根据您的问题,我认为是这种情况),请改用 javaw。
我相信它会给你想要的。
If you don't need your application to be booted from the web (which, from your question, I assume is the case), use javaw instead.
I believe it will give what you want.
我知道这个问题已经很老了,但这里有一个 javaws -wait 的替代方案:
javaws
will start ajavaw
process withcom .sun.javaws.Main
作为主类。jcmd
可以解决这个问题:这样做的一个缺点是确定实际的 java cmd:如果运行多个 Webstart 应用程序,则仅当所有应用程序都关闭时该命令才会退出。
I know this question is pretty old, but here is an alternative to
javaws -wait
:javaws
will start ajavaw
process withcom.sun.javaws.Main
as main class.The
jcmd
can come to the rescue:One down side of this is to determine the actual java cmd: if multiple webstart application are ran, then the command will exit only if all application are down.