I want to do something like "cls" in Java

A program when you want to do something like cls on Windows or clear on Linux in Java.

You can clear the screen by using the escape sequence.

System.out.print("\033[2J");

There is an output before clearing when scrolling. You can also clear the screen by executing it as an external process as shown below. In this case, scrolling has no previous output.

// Windows
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
// Linux
new ProcessBuilder("clear").inheritIO().start().waitFor();

Recommended Posts

I want to do something like "cls" in Java
[Swift] I want to do something like C's sprinftf
I want to send an email in Java.
rsync4j --I want to touch rsync in Java.
I want to use ES2015 in Java too! → (´ ・ ω ・ `)
Even in Java, I want to output true with a == 1 && a == 2 && a == 3
I want to simplify the conditional if-else statement in Java
How to do base conversion in Java
[CQ Engine] I want to handle collections like Stream or .Net LINQ even in Java 7.
Example of using Iterator in Java (Bonus: Super convenient! Compositing Iterator ~ Do something like flatMap to Iterator)
I want to stop Java updates altogether
Implement something like a stack in Java
[Java] I want to perform distinct with the key in the object
I want to use @Autowired in Servlet
I want to do team development remotely
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (PowerMockito edition)
(Limited to Java 7 or later) I want you to compare objects in Objects.equals
I want to get the IP address when connecting to Wi-Fi in Java
I want to ForEach an array with a Lambda expression in Java
[Java Spring MVC] I want to use DI in my own class
Run R from Java I want to run rJava
I want to use arrow notation in Ruby
[Ruby] I want to do a method jump!
I tried to implement deep learning in Java
I want to use java8 forEach with index
I want to pass APP_HOME to logback in Gradle
I wanted to make (a == 1 && a == 2 && a == 3) true in Java
I tried to output multiplication table in Java
[Xcode] I want to manage images in folders
I want to be eventually even in kotlin
I want to write quickly from java to sqlite
I tried to create Alexa skill in Java
I want to get the value in Ruby
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (Javassist second decoction)
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (black magic edition)
Do something like a JS immediate function in Ruby
I want to use Combine in UIKit as well.
I want to use Clojure's convenient functions in Kotlin
[Java] I want to calculate the difference from the date
I want to embed any TraceId in the log
I tried to implement Firebase push notification in Java
I want to use fish shell in Laradock too! !!
# 2 [Note] I tried to calculate multiplication tables in Java.
I want to use a little icon in Rails
I tried to create a Clova skill in Java
I tried to make a login function in Java
I want to define a function in Rails Console
I want to transition screens with kotlin and java!
I want to stop snake case in table definition
When you want to dynamically replace Annotation in Java8
I want to click a GoogleMap pin in RSpec
I tried to implement the Euclidean algorithm in Java
~ I tried to learn functional programming in Java now ~
I want to get along with Map [Java beginner]
I tried to find out what changed in Java 9
[Android Studio] I want to set restrictions on the values registered in EditText [Java]
I want to return an object in CSV format with multi-line header & filter in Java
# 1_JAVA I want to get the index number by specifying one character in the character string.
I want to convert characters ...
I made roulette in Java.
Grouping [RxJava] [1,1,2,2,3,3,1,1] like [[1,1], [2,2], [3,3], [1,1]] To do