Search code examples
javajava-9jshell

How to clear Java 9 JShell Console?


I didn't find any command to clear Java-9 JShell console. I also tried to clear the JShell Console through this program, but it doesn't work either.

import java.io.IOException;

class CLS {
    public static void main(String... arg) throws IOException, InterruptedException {
        new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
    }
}

I think we don't have that functionality available yet in the early access. Anyone got an idea?


Solution

    • I have added clear console command in JShell. You can download it from Try artifact

    -> /cls

    • It also supports maven in JShell.