4

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?

Markus
  • 578
  • 6
  • 26
  • I can confirm the tabs work fine with MacOSX and same java version. You sure about the `**tab**` sequence? – Naman May 30 '18 at 02:22
  • Yes I am sure about the tab sequence. Can you confirm the output of `/env` and `System.out.println(System.getProperty("java.class.path"))`? – Markus May 30 '18 at 06:25

2 Answers2

3

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.

0

Do you require java 10? If not try downloading java 8 using the command sudo apt-get install openjdk-8-jre to install java-8 if that does not work we can talk through some steps to install java 10

Sabith
  • 1,628
  • 2
  • 20
  • 38