如何清除 Java 控制台? [英] How do you clear the Java Console?

查看:61
本文介绍了如何清除 Java 控制台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Java 控制台 用于开始使用 webstart 的应用程序.有没有办法在代码中清除控制台消息,而不是用户手动清除消息?

I have output messages displayed on the Java console for an application that started using webstart. Instead of the user manually clearing message, is there a way of clearing console messages in code?

这些消息的打印速度约为每秒 1000 条,似乎最终使用了太多内存,我本可以停止打印到控制台,但要求始终拥有它.

These messages are printed at the rate of about 1000 per second and seem to end up using too much memory, i could have stopped the printing to console, but the requirement is to always have it.

推荐答案

您将无法清除该控制台,除非您找到该控制台类的某些句柄(我怀疑您是否有权访问).

You will not be able to clear that console, unless you find some handle on the classes for that console (which I doubt you would have access to).

您的要求不可避免地要求用户每隔几分钟就需要进入并手动清除控制台.我认为有理由重新思考为什么存在需求以及是否有其他解决方案来解决您的问题.

The requirement you have has the inevitable requirement that the user will need to go in and manually clear the console every couple of minutes. I think that justifies a rethink about why the requirement exists and wether there is another solution to solve your problem.

您是否考虑过不同的日志记录方式?

Have you considered a different way of logging?

这篇关于如何清除 Java 控制台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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