Java code opens application and icon is displayed

46 views Asked by At

When I use OpenIMAJ (using the ImageUtilities.readMBF code)(documentation here) but also other type of code (related to image conversion) an icon is displayed in the mac dock

enter image description here

1) What is the cause of this strange behavior?

2) Is there a way to disable the icon opening? Or maybe a different code to use to avoid it?

Thanks

1

There are 1 answers

0
Jon On

Any app that uses Java's BufferedImage class on the mac seems to do this by default, even if it doesn't open any windows. I think it's something to do with the way AWT initialises.

Anyway, assuming you're running from the command-line, the solution is to run the JVM in headless mode by adding -Djava.awt.headless=true to the command-line right after java. You can achieve this programmatically also - more details here: http://www.oracle.com/technetwork/articles/javase/headless-136834.html