0
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"

bubbles
  • 2,597
  • 1
  • 15
  • 40
  • 1
    Isn't that the java vm process running your program? – trojanfoe Apr 30 '20 at 11:05
  • That's simply Java running your program. If you remove the Font creating you will still see it. –  Apr 30 '20 at 11:06
  • 1
    Maybe that's just a timing issue (i.e. it takes some time to get the font info). What about if you replace it with a `for` loop with 10,000 iterations? – trojanfoe Apr 30 '20 at 11:11

1 Answers1

1

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.

Arvind Kumar Avinash
  • 71,965
  • 6
  • 74
  • 110