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

查看:122
本文介绍了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天全站免登陆