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

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

问题描述

Eclipse 的 Java 编译器是围绕与 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 已经实现了自己的编译器,称为 Java Eclipse 编译器 (ECJ).

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

它与 javac 不同,javac 是 Sun JDK 附带的编译器.一个显着的区别是 Eclipse 编译器允许您运行实际上没有正确编译的代码.如果出现错误的代码块从未运行过,您的程序将运行良好.否则,它会抛出一个异常,表明您试图运行未编译的代码.

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.

另一个区别是 Eclipse 编译器允许从 Eclipse IDE 内进行增量构建,也就是说,所有代码在您完成输入后立即编译.

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.

Eclipse 自带编译器这一事实也很明显,因为您可以在 Eclipse 中编写、编译和运行 Java 代码,甚至无需安装 Java SDK.

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.

ECJ 优于 javac 的几个例子是:

A few examples where ECJ is preferred over javac is:

  • Apache Tomcat uses ECJ to compile JSPs,
  • IntelliJ IDEA has support for ECJ, as of GNU Compiler for Java (GCJ) 4.3,
  • GCJ integrates with ECJ,
  • Liferay builds with ECJ.

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

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