java - Missing Javadoc in Eclipse for JRE 9

Eclipse Oxygen.2 (4.7.2) fails to load standard javadoc when I select my JRE 9 install as default JRE.

Is that a bug?

When I switch back to JRE 8 it works.

EDIT

So, I was a bit short on that one, let me explain. When I select a JRE for Eclipse (Preferences > Java > Installed JREs), should it be a JRE9, a JDK9, a JRE8 or a JDK8 location, when I Edit it, I can see in the jrt-fs.jar (9) or in each separated jar including rt.jar (8) a Source attachment location (empty for JRE which is normal) and Javadoc location (official HTTP URL).

That's why I expect the Javadoc to display even with a JRE.

Now when I hover over a standard Java class, say java.io.IOException or java.lang.String for example:

  • with JRE9 the Javadoc is not found in the tooltip
  • with JDK9 it is found, but:
    • if I click "open attached Javadoc in browser" I get an Oracle NotFound error page looking for http://download.java.net/java/jdk9/docs/api/java/io/IOException.html which is the URL in the Javadoc Location of JRE9 & JDK9
    • if I click a link in the tooltip, e.g. java.io.InputStream, I get an Eclipse error: Exception:org.eclipse.jdt.core.JavaModelException: I/O exception which is Caused by: java.io.IOException: null, followed by a Java Model Exception: Java Model Status [C:\Program Files\Java\jdk-9.0.4\lib\jrt-fs.jar\java.base is not on its project's build path]
  • with JRE8 or JDK8 the Javadoc is found in the tooltip as well as in the attached Javadoc in browser (docs.oracle.com/javase/8/...)

So there are at least three problems:

  • How come my tooltip doesn't work with JRE9? The possible duplicate question's answer says that Eclipse doesn't pull the tooltips from the javadoc location, so where does it pull it from?
    • [ANSWERED] from the source code if any. So I attached [jdk9_path]/lib/src.zip as Source Location in my JRE9 and it works.
  • How come Eclipe is looking for jrt-fs.jar\java.base, which does not exist?
  • How come JDK9 & JRE9 come with an incorrect Javadoc Location (http://download.java.net/java/jdk9/docs/api/)?

1 Answer

  1. Joe- Reply

    2019-11-13

    JREs are the bare runtimes, they do not contain the compiler, packaging tools, sources, or documentation. The easiest solution is often to use a JDK instead.

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>