Mac OS M1 JDK8环境下启动慢

同样的网络环境,同一个SpringBoot项目
在win10下启动,需要10秒左右
在macOS下启动,竟然需要23多秒
换成JDK17后也快了不少,JDK8也是下载ARM版本的

解决方案

  • 修改/etc/hosts文件

打开终端输入hostname,查看你的mac的主机名称(xxxMacBook.local)
没修改前应该是这个样子

1
2
3
4
5
6
7
8
9
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost

把它改成这个样子

1
2
3
4
5
6
7
8
9
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost xxxMacBook.local
255.255.255.255 broadcasthost
::1 localhost xxxMacBook.local

Mac OS M1 JDK8环境下启动慢
https://xmas-nnnut.github.io/2023/06/28/Mac-OS-M1-JDK8环境下启动慢/
作者
Xmas-nnnut
发布于
2023年6月28日
许可协议