javac和Eclipse编译器有什么区别? [英] What is the difference between javac and the Eclipse compiler?

查看:209
本文介绍了javac和Eclipse编译器有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Eclipse的Java编译器只是围绕着 javac 程序的相同核心的包装器,还是一个单独的编译器?

解决方案

Eclipse已经实现了自己的编译器,称为 Eclipse Java编译器(ECJ)。



它与javac(Sun JDK附带的编译器)不同。一个显着的区别是,Eclipse编译器允许您运行实际不正确编译的代码。如果有错误的代码块永远不会运行,你的程序将运行正常。否则,它将抛出一个异常,表示您尝试运行不编译的代码。



另一个区别是Eclipse编译器允许从Eclipse内部进行增量版本IDE,也就是说,一旦你完成输入,所有代码就被编译。



Eclipse自带编译器的事实也很明显,因为你可以编写,并且在Eclipse中运行Java代码,甚至不用安装Java SDK。



ECJ优于javac的几个示例是:




Is Eclipse's Java compiler just a wrapper around the same core that the javac program is wrapped around, or is it a separate compiler altogether? If the latter, why would they reinvent the wheel?

解决方案

Eclipse has implemented its own compiler called as Eclipse Compiler for Java (ECJ).

It is different from the javac, the compiler that is shipped with Sun JDK. One notable difference is that the Eclipse compiler lets you run code that didn't actually properly compile. If the block of code with the error is never ran, your program will run fine. Otherwise, it will throw an exception indicating that you tried to run code that doesn't compile.

Another difference is that the Eclipse compiler allows for incremental builds from within the Eclipse IDE, that is, all code is compiled as soon as you finish typing.

The fact that Eclipse comes with its own compiler is also apparent because you can write, compile, and run Java code in Eclipse without even installing the Java SDK.

A few examples where ECJ is preferred over javac is:

这篇关于javac和Eclipse编译器有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆