命令在java中清除屏幕 [英] commands in java to clear the screen

查看:258
本文介绍了命令在java中清除屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java中什么命令会让您在命令行应用程序中清除控制台?

What command in Java will let you clear the console in a command-line application?

推荐答案

想要的是清除屏幕并将光标移动到原始位置。对于那个尝试:

I think what the OP wants is to clear the screen and move the cursor to the home position. For that try:

        final String ANSI_CLS = "\u001b[2J";
        final String ANSI_HOME = "\u001b[H";
        System.out.print(ANSI_CLS + ANSI_HOME);
        System.out.flush();

这篇关于命令在java中清除屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆