5

I'm trying to run javadoc in my java project using Eclipse Kepler under Linux but I'm getting this error:

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

What am I doing wrong?

Raedwald
  • 46,613
  • 43
  • 151
  • 237
HAL9000
  • 3,562
  • 3
  • 25
  • 47
  • Can you please check if below link works for you http://stackoverflow.com/questions/3049433/intellij-gives-fatal-error-unable-to-find-package-java-lang-in-classpath-or-boo – A Paul Dec 05 '13 at 11:46
  • @ABP I cannot find File -> Project Structure -> Platform Settings -> SDKs Re-apply the JSDK home path in Eclipse, where should I look for? – HAL9000 Dec 05 '13 at 11:50

2 Answers2

4

Try adding rt.jar from JAVA_HOME/lib/ to the bootclasspath. For example :

<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>
Saša Šijak
  • 8,717
  • 5
  • 47
  • 82
  • Sorry, I cannot understand what .xml is this and where to find it. Anyway you gave me an idea of where to look. I solved adding an external jar from Project->Properties->Java Build Path. Then I used locate rt.jar to know the location of rt.jar. Thanks. – HAL9000 Dec 05 '13 at 12:30
  • it is maven pom file (http://maven.apache.org/), I assumed you used maven to build project, sorry. but yes, if you do not use maven, the way you did it is an alternative. – Saša Šijak Dec 05 '13 at 13:01
0

@HAL - The path is netbeans path. In eclipse(as you are using eclipse) there is same path. Make sure the jre path is selected properly.

In windows Eclipse the path is (Not sure about Linux)

windows > preferences > Java (Left tree) > Installed JREs

There you will get the jre's eclipse is configured with.

Remove them and add them again then refresh the project and check if this works.

A Paul
  • 8,113
  • 3
  • 31
  • 61