How can I fix poor Java performance caused by Mojave update 10.14.6? I installed the 10.14.6 macOS update yesterday, and now Java is performing very poorly.  This is especially noticeable when using Maven to build Java applications.  There are projects I build frequently that used to really tax the CPU, but now they barely use the CPU at all and they take many times longer to build.  Activity Monitor shows that the CPU, memory, disk, and network spend most of their time idling during the builds.

I installed a newer Java SDK and updated Maven to see if that would help the performance, but it made no difference.
I found the answer on a different Stack Exchange site:  https://stackoverflow.com/questions/39636792/jvm-takes-a-long-time-to-resolve-ip-address-for-localhost


Run the hostname command to get the computer's hostname.
Add two new entries to the /etc/hosts file, as shown below.  (Replace {hostname} with the output from the hostname command.)


127.0.0.1   {hostname}
::1         {hostname}