简体   繁体   English

阻止Java Coffee Cup图标出现在Mac OSX上的Dock中

[英]Stop Java Coffee Cup icon from appearing in the Dock on Mac OSX

After upgrading to OSX 10.8.4, background Java processes started placing a Java Cup icon in the Dock. 升级到OSX 10.8.4后,后台Java进程开始在Dock中放置Java Cup图标。 It causes the currently active window to loose focus which is very annoying when running some script that forks many short running Java processes (headless). 它会导致当前活动窗口失去焦点,这在运行一些需要许多短时间运行的Java进程(无头)的脚本时非常烦人。 The file menu (top of the screen next to the apple symbol will show the name of the class file that Java is running, eg org.apache.hadoop.util.RunJar). 文件菜单(苹果符号旁边的屏幕顶部将显示正在运行Java的类文件的名称,例如org.apache.hadoop.util.RunJar)。

Since I'm not explicitly launching these Java commands, I've tried putting alias java="java -Djava.awt.headless=true" in .profile but this doesn't seem to help. 由于我没有明确启动这些Java命令,我尝试在.profile中添加别名java =“java -Djava.awt.headless = true”,但这似乎没有帮助。

Has anyone run into this and know how to fix it? 有没有人碰到这个并知道如何解决它?

Thank you. 谢谢。

Like @EGHM said, it's -Dapple.awt.UIElement=true , but with no quotes . 就像@EGHM说的那样,它是-Dapple.awt.UIElement=true ,但是没有引号 At least it works for me (OS X 10.7.5). 至少它对我有用(OS X 10.7.5)。

If you happen to be using Eclipse, you can add this JVM argument globally in Preferences → Installed JREs: 如果您碰巧使用Eclipse,则可以在Preferences→Installed JREs中全局添加此JVM参数:

在此输入图像描述

Like @EHGM and @Nelson pointed out, -Dapple.awt.UIElement=true needs to be added as an argument to the JVM. 就像@EHGM和@Nelson指出的那样, -Dapple.awt.UIElement=true需要作为参数添加到JVM中。

You can set it globally for all java applications launched from the command line (or a shell) by adding it to the JAVA_TOOL_OPTIONS environment variable. 您可以通过将其添加到JAVA_TOOL_OPTIONS环境变量中,为从命令行(或shell)启动的所有Java应用程序全局设置它。

export JAVA_TOOL_OPTIONS="-Dapple.awt.UIElement=true"

You could add the export statement to your $HOME/.bashrc or whatever startup script relevant to the shell you're using. 您可以将导出语句添加到$HOME/.bashrc或与您正在使用的shell相关的任何启动脚本。

试试-Dapple.awt.UIElement =“true”

您还可以将语句放入项目级或全局gradle.properties文件中

systemProp.apple.awt.UIElement=true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM