Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

I've been finding that since I got my new MacBook Pro and installed Java 8 on it, all of the Java Applications that I've been running have been taking an extremely long time to start or to establish network connections. This didn't seem to affect Java Applications that didn't use the network however. Turns out that the problem is to do with the local machine's hostname resolution and is easily fixed.

First you need to find the hostname of your Mac. You do this from System Preferences. Click the Sharing icon in System Preferences.
javahosts_1.png


You will see a box that shows the Computer Name, under that will be the hostname ending in .local. That's what you will need, so take note of it. In my case it was Enzyme.local.
javahosts_2.png




The next step is to update your /etc/hosts file. This must be done as root, so at the Terminal, type in "sudo vi /etc/hosts". This will ask for your password...
javahosts_4.png


Add the hostname you noted from earlier at the end of lines that start with "127.0.0.1" and "::1". If you don't know how to use vi, look here. You can also use nano instead, just replace "vi" in the command above with "nano".

In the end this is what my /etc/hosts file looked like:
javahosts_3.png


After making this change, I noticed that SoapUI took 5 seconds to start, before it was taking 21 seconds. Also SQL Developer was now taking just 3 seconds to connect to a database, versus 21 seconds prior to this change.

-i

Did you like this post or found it useful? Considering supporting this Blog to keep its web servers running, any amount helps! Thanks!
Have comments or feedback on what I wrote? Please share them below!
comments powered by Disqus
Other posts you may like...