Eclipse 如何仅使用 JRE 编译类? [英] How does Eclipse compile classes with only a JRE?

查看:26
本文介绍了Eclipse 如何仅使用 JRE 编译类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用已定制"的特殊 JRE 对编译进行批处理.

I need to batch a compilation with a special JRE which has been "customized".

Eclipse 能够用这个 JRE 编译类,但我需要在 Eclipse 之外制作一个构建脚本.

Eclipse is able to compile the classes with this JRE, but I need to make a build script outside of Eclipse.

Eclipse 使用什么方法在没有 JDK 的情况下生成 .class 文件?

What is the method used by Eclipse to generate the .class files without a JDK?

推荐答案

Eclipse 自带编译器,原因如下:

Eclipse comes with its own compiler for the following reasons:

  • 增量编译(可以只编译项目中更改的部分,这可能意味着比您刚保存的文件数量更多,例如,当您更改某些全局时)
  • 即使代码包含错误,Eclipse 编译器也可以创建类文件.这允许运行项目,即使不是所有的东西都能编译.
  • 编译器为 Eclipse 提供了一个 AST,所以它可以做各种花哨的事情(比如大纲,向您展示使用光标下的变量的所有位置等),无需额外成本(即它不必运行编译器另一个解析器).
  • Incremental compilation (can compile just the changed parts of the project which can mean more than the amount of files you just saved, for example, when you changed some global)
  • The Eclipse compiler can create a class file even when the code contains errors. This allows to run the project even though not everything compiles.
  • The compiler provides Eclipse with an AST so it can do all kinds of fancy stuff (like the outline, show you all the places where the variable under the cursor is used, etc) at no extra cost (i.e. it doesn't have to run the compiler and another parser).

这篇关于Eclipse 如何仅使用 JRE 编译类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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