Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging in IntelliJ (Reloading changed classes)

Tags:

I recently switched from eclipse to IntelliJ. Eclipse's debug launcher used to reload the application instantly, whenever a class was saved. IntelliJ takes more than 10 secs to reload changed classes, which might not be a lot, but it is annoying because I use it so frequently.

How to make IntelliJ reload changed classes faster?

like image 970
kr15hna Avatar asked Sep 21 '15 09:09

kr15hna


People also ask

Why Debug is not working in IntelliJ?

To solve this, simply remove the jar of the debugged module from all modules' dependencies in the Project Structure. If you do not know which modules have the debugged module jar as dependencies, you can use some tools (Eg. Sublime Text, bash, ...) to search for the module name which is stored in Intellij *.

What does drop frame do in debugging?

Drop Frame within the debugger pops the current stack frame and puts control back out to the calling method, resetting any local variables. This is very useful to repeatedly step through a function, but be warned: field mutations or global state changes will remain.

What is HotSwap in IntelliJ?

The HotSwap mechanism lets you reload classes changed during a debugging session without having to restart the entire application.


2 Answers

To reload changed classes

  1. Do one of the following:
  • On the main menu, choose Run | Debugging Actions | Reload Changed Classes.
  • On the main menu, choose Build | Compile "class_name" to recompile an altered class during debug.
  1. In the Reload Changed Classes dialog box, confirm reloading. Results are displayed in the Messages tool window.

Refer this link for detailed explanation.

like image 125
Prince Avatar answered Sep 22 '22 07:09

Prince


InteliJ is not recompiling the code after change in java files and rebuilding

  1. Project > Setting>Build,Execution,Deployment>Compiler>check "build project automatically"

  2. Ctrl+Shift+A find "registry", according to your requirements check the following:

    compiler.automake.allow.when.app.running
    compiler.automake.trigger.delay=500
    
  3. Add devtool in pom.xml:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>
    
  4. Build, If found any probelm while building, saying some jar in not in class path. Just delete the corrupted jar and re-build the project angain after sync with maven libb

like image 30
Priyanshu Singh Avatar answered Sep 23 '22 07:09

Priyanshu Singh