简体   繁体   中英

How debugging is much easier in eclipse for java programs?

Whenever I write a program in eclipse each line gets complied as go to next line.It shows compilation is done while writing he program only. Does it mean javac.exe file is run whenever you write a line of program? It debugging is much easier in Eclipse.

Eclipse has his own compiler (JDT). It does not use the javac.exe compiler. The question is how does it achieve such short compilation times?

The internal data structure maintained by Eclipse for representing a Java program (AST) is the same data structure used by the JDT compiler. This sharing of data allows the compiler to run faster as it does not need to re-compile the whole program (or even the whole file) again.

Also, unlike javac.exe the JDT compiler resides inside Eclipse. It is not a separate process so it does not need to be loaded (by the operating system) the same way javac.exe does.

In addition to that (and this is true to all Java compilers), Java has dynamic linking. Each class is linked into the program when it is loaded during the execution of the program. This obviates the need for a linking phase at the end of compilation (a-la C/C++/C#). The linking phase is generally quite long as it processes the program as a whole (as opposed to compilation which is carried out on aa file-by-file basis). Thus, linking gets slower as the program grows. Techniques such as incremental linking have managed to mitigate this slow-down but not entirely.

Given that Java needs no (static) linking, you can get to a state where a Java program is ready to run much faster than in other (statically linked) languages.

Eclipse actually has it's own compiler that is compiling your code as you type. It's not javac.exe but you can read more about it at the JDT page .

I believe the Eclipse IDE uses its own Java compiler.

Javac.exe is Sun's own official Java compiler, which I'm sure the Eclipse compiler borrows heavily from.

You can turn it off in Project->Build Automatically. Eclipse is using it's own java compiler - eclipsec instead of javac.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM