Search code examples
debianjava-10jshelldebian-buster

Java 10: "No documentation found" for System.out.println(...)


On a debian 10, I install Java SE 10 using apt-get install openjdk-10-jdk openjdk-10-doc. I called jshell and wanted to get the documentation of System.out.println(...), but got an error <no documentation found>:

|  Welcome to JShell -- Version 10.0.1
|  For an introduction type: /help intro

jshell> System.out.println( **<tab>**
Signatures:
void PrintStream.println()
void PrintStream.println(boolean x)
void PrintStream.println(char x)
void PrintStream.println(int x)
void PrintStream.println(long x)
void PrintStream.println(float x)
void PrintStream.println(double x)
void PrintStream.println(char[] x)
void PrintStream.println(String x)
void PrintStream.println(Object x)

<press tab again to see documentation>

jshell> System.out.println( **<tab>**
void PrintStream.println()
<no documentation found>

<press tab to see next documentation>

jshell> /env

jshell> System.out.println(System.getProperty("java.class.path"))
.

jshell> 

I do not think this is related to How to make javadoc documentation available in JShell? as I want to get the documentation for some standard method. (This question ends in bug https://bugs.openjdk.java.net/browse/JDK-8188142. Problem was that the classpath wasn't defined properly).

How do I get documentation in jshell?


Solution

  • If you are using Debian based system you will have to install the openjdk-<vserion>-source package to has JShell's documentation work. In your case you will need to execute

    sudo apt install openjdk-10-source
    

    The documentation you can get by double tab in JShell is from the /usr/lib/jvm/java-<version>-openjdk-amd64/lib/source.zip file which is a dead link before you install the openjdk-<vserion>-source package. The link is pointing at ../../openjdk-<vserion>/src.zip.