如何启动 java-web-start 应用程序并等待它退出? [英] How to start a java-web-start application and wait until it exits?

查看:35
本文介绍了如何启动 java-web-start 应用程序并等待它退出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现 javaws -wait 不能执行在 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.

这个错误已经超过 5 年了,因为无法修复而关闭6281477,所以我们需要一个解决方法.

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:

  • 无人值守运行(无需用户干预):
    • 目前如果 JNLP 文件不可访问,Java 将显示一个错误窗口.

    最好为此 Java 或 Python 提供跨平台解决方案,但即使是 Windows 批处理解决方案也是可以接受的.

    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.

    推荐答案

    我知道这个问题很老了,但这里有一个 javaws -wait 的替代方案:javaws将启动一个 javaw 进程,以 com.sun.javaws.Main 作为主类.

    I know this question is pretty old, but here is an alternative to javaws -wait: javaws will start a javaw process with com.sun.javaws.Main as main class.

    jcmd 可以派上用场:

    while jcmd com.sun.javaws.Main PerfCounter.print > /dev/null 2> /dev/null  ; do
      echo "still running !"
      sleep 2
    done
    

    这样做的一个缺点是确定实际的 java cmd:如果运行了多个 webstart 应用程序,那么只有当所有应用程序都关闭时,该命令才会退出.

    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.

    这篇关于如何启动 java-web-start 应用程序并等待它退出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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