java.net.InetAddress: getLocalHost() slow after MacOS Sierra upgrade?

If Java takes forever to getLocalHost after MacOS Sierra upgrade, here's what you can do to fix it!