如何启用Intellij热门代码交换 [英] How to enable Intellij hot code swap
问题描述
Intellij似乎没有在我的安装上进行基本的热代码交换。
Intellij does not seem to be doing basic hot code swap on my installation.
对于此代码:
public class MainTest {
public void method1() {
System.out.println("Breakpoint here");
}
public void method2() {
System.out.println("Line that will get 24 modified");
}
public static void main(String[] args) {
System.out.println("First print here");
MainTest mainTest = new MainTest();
mainTest.method1();
mainTest.method2();
System.out.println("Line that I do not modify");
}
}
我在上放了一个断点mainTest.method1();
然后修改method2()处的字符串,点击ctrl + s并继续一步一步。遗憾的是,运行时未更新,正在打印旧字符串。完全停止 - 编译 - 运行会打印新字符串。所以我的结论是热插拔不工作。
I put a breakpoint on mainTest.method1();
then modify the string at method2(), hit ctrl+s and continue to step by step. Unfortunately the runtime is not updated, old string is being printed. Full stop - compile - run does print the new string. So my conclusion is hot-swap not working.
我需要设置什么设置来启用热代码交换?
Is there any settings I need to set to enable hot code swap?
- Ubuntu,JDK 1.6
- Intellij 10.5 Ultimate(评估)
推荐答案
在等待断点的同时保存你的课程后,只需用 Build - >重新编译你的课程。使用标准键绑定编译'MainTest.java'
或按 Ctrl + Shift + F9
。
After saving your class while waiting on your breakpoint just recompile your class with Build -> Compile 'MainTest.java'
or press Ctrl+Shift+F9
with the standard key bindings.
IntelliJ IDEA将显示一个小对话框,询问您是否要重新加载该类。
IntelliJ IDEA will then show a small dialog in which it asks you if you want to reload that class.
这篇关于如何启用Intellij热门代码交换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!