JDK 8 is a heavy problem on MacOS

background

I'm developing with Eclipse using MacBook Pro (2016 Touch Bar model), but Java 1.8 starts up very slowly ... In my case, I'm doing something like Maven-> Compile-> Tomcat Run-> Test in Spring Boot, but it takes too long to start Tomcat. Frustrated. I was wondering if something could be done, but there was a way to solve it, so I wrote this article.

There is information on stackoverflow for the cause of this, so please refer to that for details.

InetAddress.getLocalHost() slow to run (30+ seconds) https://stackoverflow.com/questions/33289695/inetaddress-getlocalhost-slow-to-run-30-seconds/40487173?stw=2#40487173

Solution

Launch a terminal and check your Mac's host name.

~ hogehoge$ hostname


 MacBook-Pro.local ← This will be returned

 After that, let's add `` `MacBook-Pro.local``` to the hosts file.
 This alone should speed up startup.

 * The following is an example, so please do not copy it as it is.


#### **`/etc/hosts`**
```text

127.0.0.1   localhost MacBook-Pro.local
::1         localhost MacBook-Pro.local

The Java I'm using is:

$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

Recommended Posts

JDK 8 is a heavy problem on MacOS
Uninstall old JDK on macOS
[Java] Stepping on a JDK compiler bug
Install OpenJDK on macOS
Q & A about JDK
What is a constructor?
What is a stream
What is a Servlet?