简体   繁体   English

导入com.sun.javadoc,与Eclipse和Ant结合使用

[英]Import com.sun.javadoc, using with Eclipse and Ant

I have an open source project I'm working with called RapidMiner where I need to be able to use com.sun.javadoc so that I can compile a plug-in using an Ant build file. 我有一个正在使用的名为RapidMiner的开源项目,在这里我需要能够使用com.sun.javadoc,以便可以使用Ant构建文件来编译插件。 I found a thread that explained that I needed to include the .jar from the JDK and gave some simple instructions on how to do this ( See here ). 我找到了一个线程,该线程解释说我需要包括JDK中的.jar,并给出了一些有关如何执行此操作的简单说明( 请参见此处 )。

It seems to have worked on a basic level. 它似乎在基本水平上起作用。 I now can use com.sun.javadoc and have it work with content assist. 现在,我可以使用com.sun.javadoc并将其与内容辅助一起使用。 So I'm under the impression that Eclipse, at very least, can see it. 因此,我给人的印象是,至少Eclipse可以看到它。

The problem is that Ant refuses to see it. 问题是Ant拒绝看到它。 I've made sure that when I run build.xml it uses the proper JRE (called jre7JDK in my particular case). 我已确保在运行build.xml时使用正确的JRE(在我的特殊情况下称为jre7JDK)。 But evertime I run the build I get this error (the second error is the important one): 但是每次运行构建时,都会出现此错误(第二个错误是重要的错误):

build.common:
 [echo] RapidMiner: Compile with Java from dir: C:\Program Files\Java\jre7
 [echo] RapidMiner: using Java version: 1.7.0_17
[javac] Compiling 12 source files to C:\Users\jcarr14\Eclipse\Workspace\RapidMiner_Unuk\build
[javac] C:\Users\jcarr14\Eclipse\Workspace\RapidMiner_Unuk\src\com\rapidminer\doc\AbstractOperatorDocGenerator.java:40: warning: [deprecation] com.rapidminer.operator.condition.InnerOperatorCondition in com.rapidminer.operator.condition has been deprecated
[javac] import com.rapidminer.operator.condition.InnerOperatorCondition;
[javac]                                         ^
[javac] C:\Users\jcarr14\Eclipse\Workspace\RapidMiner_Unuk\src\com\rapidminer\doc\AbstractOperatorDocGenerator.java:49: package com.sun.javadoc does not exist
[javac] import com.sun.javadoc.ClassDoc;

There are a few thousand more errors listed as well, but they all boil down to the same thing, Ant is not compiling in a way that see's the JDK's .jars, which I need to include. 还列出了几千个错误,但是它们全都归结为同一件事,Ant的编译方式不是我需要包括的JDK的.jars。 How do I make Ant see those .jars? 如何让Ant看到那些.jar?

The answer actually turned out to be pretty straight forward. 答案实际上很简单。 All I did was point the Ant build in Eclipse at the actual JDK itself (which was alluded to in another thread that I cannot seem to find...). 我所做的只是将Eclipse中的Ant构建指向实际的JDK本身(这被暗示在另一个我似乎找不到的线程中……)。 I did this by creating a new Environment wide JRE that was pointed at the JDK's root folder instead. 我通过创建一个新的环境范围内的JRE来做到这一点,该环境指向JDK的根文件夹。 Then when I would go to use build.xml, I would use "Run As..." then Ant Build, then I would go to the JRE tab and select the JDK backed JRE. 然后,当我要使用build.xml时,我将使用“ Run As ...”然后是Ant Build,然后我将转到“ JRE”选项卡并选择JDK支持的JRE。 It's worked fine ever since. 从那时起,它一直运行良好。

I'm still not quite sure why including the JDK jars inside of my custom JRE didn't work, but there you go. 我仍然不太确定为什么在我的自定义JRE中包含JDK jar不能正常工作,但是您就可以了。

Update: Found the post it was "alluded to" in. Though when I read it now, it seems pretty straight forward (as it often does after you get it working): Right here . 更新:找到了该文章的“替代品”。尽管当我现在阅读该文章时,它看起来很简单(就像在您开始工作后经常这样做一样): 就在这里

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

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