Home > Mobile >  How do I reload IntelliJ classes for a Java project?
How do I reload IntelliJ classes for a Java project?

Time:02-05

A while ago I remember being able to run a Java application in debug mode and then I could use some keyboard short code to either reload the class I am currently on or use different keyboard shortcut to reload all classes. The issue is I forgot what those shortcuts were and I have been googling it for the past 30 minutes without being able to find it.

CodePudding user response:

IntelliJ will use Java's "HotSwap" feature for reloading classes when the JVM ist started in debug mode. Just compile the project and it should work. The default setting for IntelliJ is to ask if you want to reload the classes but you can change this under settings - see screenshot (search for HotSwap).

HotSwap can only live change non-structural code changes (changing an implementation of a method). HotSwap will not work when you change the class structure or method signatures.

If you want to reload structural changes as well you will have to use additional tools (Spring DevTools, JRebel). Some frameworks like Quarkus support structural live-reloading out of the box.

Settings - HotSwap

  • Related