开发者

How to start a java-web-start application and wait until it exits?

开发者 https://www.devze.com 2023-01-17 16:59 出处:网络
I just found out that javaws -wait doesn\'t do what is supposed to do on Windows. It will return before the aplication finishes.

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):
  • 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.


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.


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.

The jcmd can come to the rescue:

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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消