防止后台进程显示在Dock上 [英] Prevent background process from showing up on Dock

查看:94
本文介绍了防止后台进程显示在Dock上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Java应用程序.对于某些任务,我使用ProcessBuilder并行运行另一个JVM实例.即我的主应用程序使用Process启动另一个JVM实例,然后两者都使用I/O进行通信.

I have a Java application. For some tasks, I run another JVM instance in parallel using ProcessBuilder. i.e. my main application starts another JVM instance using Process and then both communicate using I/O.

但是在Mac上的Dock上,它同时显示了两个过程:

But on the Dock on Mac, it shows both the process:

我不希望这样,因为其他过程仅做后端工作,不需要在前面显示.这也是一种风险,因为他可以手动强制退出其他进程.

I do not want that, as the other process only does the back-end work and is not required to be shown up front. Also it is a risk as he can manually force quit the another process easily.

应该做些什么来确保它在后台运行并且不会在码头上显示出来

What should be done to make sure it runs on background and doesn't show itself on dock

推荐答案

如果您的后端处理器确实不需要任何屏幕资源,那么最简单的方法就是在 headless 模式:

If your back-end processor truly does not need any screen resources then the simplest thing to do is too launch the new JVM in headless mode:

java -Djava.awt.headless=true com.bl.ProcessMain

这篇关于防止后台进程显示在Dock上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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