After the following changes and enabling hot swapping, changing the Java file took 1-2 seconds to restart. (The initial launch time for me is about 7 seconds).
I hope the below method helps ...
First, you need to check "Make the project automatically" in the settings menu.
Open the settings menu;
You can go to the top menu and press;
IntelliJ IDEA â Settings
or you can enter a shortcut below using the keyboard;
cmd + option + s
Then you can check the box " Make project automatically as shown in the image below;

Secondly, you need to change the registry setting compiler.automake.allow.when.app.running to true.
To open the registry, you need to press the key combination below:
cmd + shift + a
Enter registry as shown in the figure below, select Registry and press the enter button on the keyboard;

After opening the Registry window, enter compiler.automake to see the compiler.automake.allow.when.app.running parameter, and mark it as shown in the figure below;

Then you need to restart IntelliJ for the registry changes to work.
Berk Dec 29 '16 at 10:21 2016-12-29 10:21
source share