Why Java Font add a java icon in the Dock of macOs?

166 Views Asked by At
public static void main(String[] args) {

    Font arial = Font.getFont(ImmutableMap.of(TextAttribute.FAMILY, "Arial"));
    System.out.println(arial);
}

Having this little program, when executing it on my Mac, it runs (I think) another java process which appears on the Dock (see image below). This icon disappears as soon as the main method ends.

enter image description here

Anyone have an idea why this happens and how to get rid of it ?

NB: The origin of this question is java POI HSSFSheet class. I'm generating some xls files in a web application and when I call HSSFSheet.autoSizeColumn the icon appears in the Dock (nothing happens when a don't call autoSizeColumn). When I followed this issue I found that the icon appears when POI calls Font.getFont.

Environment:
macOS Catalina: 10.15.4
java version "1.8.0_112"

1

There are 1 best solutions below

4
Arvind Kumar Avinash On

It happens momentarily because of the following classes:

java.awt.Font;
java.awt.font.TextAttribute;

In short, it will happen with any code using AWT or Swing libraries.