Java 10:System.out.println(...)

时间:2018-05-29 23:04:48

标签: debian java-10 jshell debian-buster

在debian 10上,我使用apt-get install openjdk-10-jdk openjdk-10-doc安装Java SE 10。我致电jshell并希望获取System.out.println(...)的文档,但收到错误<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> 

我不认为这与How to make javadoc documentation available in JShell?有关,因为我想获得某些标准方法的文档。 (这个问题以bug https://bugs.openjdk.java.net/browse/JDK-8188142结束。问题是类路径没有正确定义。)

如何在jshell中获取文档?

2 个答案:

答案 0 :(得分:1)

如果您使用的是基于Debian的系统,则必须安装openjdk-<vserion>-source软件包才能使用JShell的文档。在您的情况下,您将需要执行

sudo apt install openjdk-10-source

在JShell中,通过双标签可以获得的文档来自/usr/lib/jvm/java-<version>-openjdk-amd64/lib/source.zip文件,该文件是安装openjdk-<vserion>-source软件包之前的无效链接。链接指向../../openjdk-<vserion>/src.zip

答案 1 :(得分:0)

您需要Java 10吗?如果不是,请尝试使用以下命令下载 java 8 sudo apt-get install openjdk-8-jre安装 java-8 如果不起作用,我们可以通过一些步骤来安装 java 10