有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java实时代码编译?

我在http://www.humblebundle.com观看livestream,看到他们正在运行应用程序,并在Eclipse中更改代码。这只是下一次编译和运行时的更改,还是他真的在运行应用程序时对其进行了更改


共 (5) 个答案

  1. # 1 楼答案

    调试器的功能是在运行时更改应用程序代码。在Eclipse和许多其他流行的IDE中,它是“开箱即用”的。该特性有几个限制:无法更改方法签名、添加/删除类成员等

  2. # 2 楼答案

    这被称为hot code replace

    The idea is that you can start a debugging session on a given runtime workbench and change a Java file in your development workbench, and the debugger will replace the code in the receiving VM while it is running. No restart is required, hence the reference to "hot".

  3. # 3 楼答案

    从这条溪流看不出来。Java在某种程度上可以同时实现这两种功能——您可以使用调试器替换JVM加载的类,但有一些限制。还有JRebel,它摆脱了很多限制

  4. # 4 楼答案

    如果处于调试模式,则可以在应用程序运行时进行某些更改。它是否有效取决于更改是否为当前加载的代码。例如,您可以在程序不排序时更改排序函数,下次排序时它将使用新代码

  5. # 5 楼答案

    有时候。 在调试模式下,eclipse可以在运行的JVM中编译和更改类文件,这称为热代码替换

    The idea is that you can start a debugging session on a given runtime workbench and change a Java file in your development workbench, and the debugger will replace the code in the receiving VM while it is running. No restart is required, hence the reference to "hot".

    资料来源:Eclipse Wiki

    在某些情况下,这将不起作用,在这种情况下,Eclipse将提示您重新启动。 Hot code replace failed