10

我知道有很多与我类似的问题,但即使在阅读完所有问题后,我实际上也无法解决我的问题。我有一个 Java 应用程序,一旦启动它就会进入托盘。问题出在 Mac 上,因为只有图标在托盘栏和 Dock 中。我想摆脱 Dock 图标。

我已经进行了多次试验:尝试将我的 jar 包装在“.app”文件夹中并编写 Info.plist 文件。我插入了 LSUIElement 并将其设置为“1”或“true”。这隐藏了应用程序图标,但显示了一个丑陋的灰色图标终端,就像终端一样。

屏幕

即使您有任何想法或其他方法可以绕过它,也请告诉我。谢谢你。

4

1 回答 1

11

You may be using the wrong property name for what you want. Have a look here:

https://developer.apple.com/library/mac/#documentation/Java/Reference/Java_PropertiesRef/Articles/JavaSystemProperties.html

The property you want to set is, I think:

"apple.awt.UIElement" (not "LSUIElement")

There are two ways you can do that. You can pass:

-Dapple.awt.UIElement="true"

as a VM argument, or you can set a property in the Info.plist as:

<key>Properties</key>
  <dict>
    <key>apple.awt.UIElement</key>
    <string>true</string>
  </dict>
于 2012-06-21T14:38:06.363 回答