MacOS dock freezes when I launch Java application
When I launched these Java programs (why only Java applications I honestly don't know...) I remember I inserted a network sharing shortcut in the Mac OS dock.

I think MacOS as a side effect tried to analyse this folder (which is in fact a network storage) while it was in the dock ; which causes all these lags since the network shared folder is not all the time connected (when I'm not @ home, or even if I am at home and the NAS is sleeping).

TL;DR If you have any kind of network shared / FTP folder as a shortcut in your Mac OS dock you may try to remove it to see if the lags are disappearing.