MacOS dock freezes when I launch Java application I have a late-2016 MacBook Pro (without Touchbar) - MacOS High Sierra 10.13.2 - Java 9

Since one or two weeks, when I launch a Java application (NetBeans, a JavaFX app, Eclipse... etc) my MacOS docks freezes for at least 5 seconds before unfreezing and showing the application in the dock (and launching it). I can't switch between applications. It does the same thing when I try to compile applications from my development environment. It's unusable for now...

Do you have any solutions?

EDIT : Tried to uninstall Java, still the same thing. When I launch the Java installer it does the same problem : dock/mac freeze for 5 seconds...
EDIT 2 : Tried to launch a console program : no problem. This is only when I launch a GUI 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.