创建javadoc时出现FatalError(无法找到包java.lang)

时间:2013-11-28 18:25:40

标签: java eclipse javadoc

我正在尝试在Linux下使用Eclipse Kepler在我的java项目中运行javadoc,但是我收到了这个错误:

Constructing Javadoc information...
com.sun.tools.javac.util.FatalError: Fatal Error: Unable to find package java.lang in classpath or bootclasspath
    at com.sun.tools.javac.comp.MemberEnter.importAll(MemberEnter.java:137)
    at com.sun.tools.javac.comp.MemberEnter.visitTopLevel(MemberEnter.java:521)
    at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:454)
    at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:400)
    at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:831)
    at com.sun.tools.javac.code.Symbol.complete(Symbol.java:400)
    at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:782)
    at com.sun.tools.javac.comp.Enter.complete(Enter.java:481)
    at com.sun.tools.javac.comp.Enter.main(Enter.java:459)
    at com.sun.tools.javadoc.JavadocEnter.main(JavadocEnter.java:71)
    at com.sun.tools.javadoc.JavadocTool.getRootDocImpl(JavadocTool.java:180)
    at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:364)
    at com.sun.tools.javadoc.Start.begin(Start.java:162)
    at com.sun.tools.javadoc.Main.execute(Main.java:59)
    at com.sun.tools.javadoc.Main.main(Main.java:49)
javadoc: error - fatal error
1 error

我做错了什么?

2 个答案:

答案 0 :(得分:4)

尝试将rt.jar / JAVA_HOME/lib添加到bootclasspath。例如:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.9.1</version>
        <configuration>
           <minmemory>256m</minmemory>
           <maxmemory>1024m</maxmemory>
           <!-- error fix -->
           <bootclasspath>${java.home}/lib/rt.jar</bootclasspath>
        </configuration>
        <reportSets>
           <reportSet>
              <reports>
                 <report>aggregate</report>
              </reports>
           </reportSet>
        </reportSets>
     </plugin>

答案 1 :(得分:0)

@HAL - 路径是netbeans路径。在eclipse中(当你使用eclipse时)有相同的路径。确保正确选择了jre路径。

在windows Eclipse中,路径是(不确定Linux)

windows&gt;偏好&gt; Java(左树)&gt;已安装的JRE

你会得到jre的eclipse配置。

删除它们并再次添加它们然后刷新项目并检查它是否有效。