Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 997
B. S. Rawat Avatar asked Apr 25 '16 17:04

B. S. Rawat


People also ask

What is Clrscr () in Java?

public static void clrscr(){ //Clears Screen in java.

Which code is used to clear the console?

cls() like clrscr() ,system(“clear”) we use system. cls() function to clear console screen .

What is the use of JShell in Java 9?

The Java Shell tool (JShell) is an interactive tool for learning the Java programming language and prototyping Java code. JShell is a Read-Evaluate-Print Loop (REPL), which evaluates declarations, statements, and expressions as they are entered and immediately shows the results. The tool is run from the command line.


Video Answer


1 Answers

Use the Control Key+L or l (lower case L) to clear the JShell console.

like image 173
snr Avatar answered Sep 23 '22 00:09

snr