简体   繁体   English

Eclipse Ant JDK问题

[英]Eclipse Ant JDK issue

I have given atask to buld the ant file. 我给了一个任务,要把这个蚂蚁文件。 The interestuing path is there is no JDK installed, only JVM is installed. 有趣的路径是没有安装JDK,仅安装了JVM。 It seems to me that Eclipse is using internally JDK. 在我看来,Eclipse在内部使用JDK。

Now, when I run the ant file it's throwing me an exception Unable to find a javac compiler; 现在,当我运行ant文件时,它抛出了一个异常无法找到javac编译器。 so how Can I fix this ? 那我该如何解决呢?

I found this in the current Eclipse help: Using the ant javac adapter 我在当前的Eclipse帮助中找到了这一点: 使用ant javac适配器

The Eclipse compiler can be used inside an Ant buildfile using the javac adapter. 使用javac适配器,可以在Ant构建文件内部使用Eclipse编译器。 In order to use the Eclipse compiler, you simply need to define the build.compiler property in your buildfile. 为了使用Eclipse编译器,您只需要在buildfile中定义build.compiler属性。

This might also work in Eclipse 3.4. 这在Eclipse 3.4中也可能起作用。 Ganymede help files aren't online. Ganymede帮助文件不在线。

Edited to add the ant compiler property definition: 编辑后添加了ant编译器属性定义:

 <property name="build.compiler" 
    value="org.eclipse.jdt.core.JDTCompilerAdapter"/>

Eclipse JDT (Java developement tool) is able to run on top of a JRE only as you said because it embed its own Java compiler. Eclipse JDT(Java开发工具)只能像您所说的那样在JRE之上运行,因为它嵌入了自己的Java编译器。 I think you can use this compiler to compile code outside Eclipse but I am not able yet to find ressources on the web explaining how to do this. 我认为您可以使用此编译器在Eclipse之外编译代码,但是我尚无法在Web上找到解释如何执行此操作的资源。

Moreover I am not sure you will be able to tell Ant (here I speak about Ant running outside Eclipse, because Eclipse also has its own internal Ant runner) to use this compiler instead of using the javac compiler find in default location. 而且,我不确定您是否能够告诉Ant(在这里我说的是Ant在Eclipse外部运行,因为Eclipse也有自己的内部Ant运行器)使用此编译器,而不是使用默认位置的javac编译器。

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

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