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

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.