简体   繁体   English

Eclipse在哪里找到javac来编译项目?

[英]Where does Eclipse find javac to compile a project?

Here is what I have: 这是我有的:

JAVA_HOME=C:\\Software\\Java\\jdk1.5.0_12 (points to JDK 5.0) JAVA_HOME = C:\\ Software \\ Java \\ jdk1.5.0_12(指向JDK 5.0)

In Eclipse "Installed Runtimes" I have: jre 1.5.0_12 (points to JRE 5.0) jre 1.6.0_3 (points to JRE 6.0) (this one is default) 在Eclipse“Installed Runtimes”中我有:jre 1.5.0_12(指向JRE 5.0)jre 1.6.0_3(指向JRE 6.0)(这是默认值)

I do not have "javac" on my PATH (ie I cannot run javac -version from command line if I am not in JDK/bin). 我的PATH上没有“javac”(即如果我不在JDK / bin中,我无法从命令行运行javac -version)。

My project is set to use jre 1.6.0_3 and compiler's Compliance Level is set to 6.0. 我的项目设置为使用jre 1.6.0_3,编译器的合规级别设置为6.0。

Question is: how Eclipse is able to compile my project? 问题是:Eclipse如何编译我的项目? Where it finds a compiler for 6.0? 在哪里找到6.0的编译器? Moreover, is there a way to tell precisely which compiler (ie path to javac) is used by Eclipse? 此外,有没有办法准确地告诉Eclipse使用哪个编译器(即javac的路径)?

PS OS XP SP2 if it is relevant PPS I do not have any -vm set in eclipse.ini. PS OS XP SP2如果它是相关的PPS我没有在eclipse.ini中设置任何-vm。 In eclipse I see eclipse.vm=C:\\Program Files\\Java\\jre6\\bin\\client\\jvm.dll and it is still a JRE. 在eclipse中,我看到eclipse.vm = C:\\ Program Files \\ Java \\ jre6 \\ bin \\ client \\ jvm.dll,它仍然是一个JRE。

Eclipse有JDT ,它包含增量编译器,所以它不需要外部编译器,除非你愿意:)

Eclipse has a list of installed JRE's under window->preferences->java->Installed JRE's . Eclipse在window-> preferences-> java-> Installed JRE下有一个已安装JRE的列表。 The one selected as the default will be the one included with Eclipse, but you can easily add any other JRE's from this same preference pane, and select any default you wish. 选择作为默认值的那个将是Eclipse附带的那个,但您可以从同一个首选项窗格轻松添加任何其他JRE,并选择您希望的任何默认值。

This will be the system wide default, which can be overridden on a project by project basis from the Build Path->Libraries tab. 这将是系统范围的默认值,可以在“构建路径” - >“库”选项卡中逐个项目地覆盖它。 To change, select Add Library->JRE System Library and choose from your configured JRE's. 要进行更改,请选择添加库 - > JRE系统库,然后从配置的JRE中进行选择。 Then remove the library for the default. 然后删除库的默认值。

Eclipse is shipped with an built-in compiler. Eclipse附带内置编译器。 You can use an external JDK, if you configure it in the preferences. 如果在首选项中配置外部JDK,则可以使用外部JDK。

Edit: Thanks to André! 编辑:感谢André!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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