Topic: 请教:LINUX下Console输出信息的清屏命令 |
Print this page |
1.请教:LINUX下Console输出信息的清屏命令 | Copy to clipboard |
Posted by: xxg0621 Posted on: 2004-11-01 10:41 我现在要用java做一个类似与Fdisk的dos下的菜单式界面,但是我不知道在向屏幕输出信息之前如何清屏。那位大哥知道?我不胜感激!我的程序是要在linux系统下运行的 . |
2.Re:请教:LINUX下Console输出信息的清屏命令 [Re: xxg0621] | Copy to clipboard |
Posted by: littledeer1974 Posted on: 2004-11-01 11:02 clear 相当于DOS的CLS http://www.yesky.com/20030306/1655486_11.shtml {这个我想应该自己能查到的吧} |
3.Re:请教:LINUX下Console输出信息的清屏命令 [Re: littledeer1974] | Copy to clipboard |
Posted by: xxg0621 Posted on: 2004-11-01 18:59 怎么加到java代码里面呀?大哥 比如说我要输出字符串 pringln("Hello"); println("How are you!"); 我怎么让Linux 的shell在显示输出字符串Hello之前清屏? |
4.Re:请教:LINUX下Console输出信息的清屏命令 [Re: xxg0621] | Copy to clipboard |
Posted by: littledeer1974 Posted on: 2004-11-01 21:24 xxg0621 wrote: 你在你的第一贴里没有问这个呀,老大,这是谁的问题呢? 你自己得首先问清楚对不对呢? |
5.Re:请教:LINUX下Console输出信息的清屏命令 [Re: littledeer1974] | Copy to clipboard |
Posted by: ditty Posted on: 2004-11-02 08:29
|
6.Re:请教:LINUX下Console输出信息的清屏命令 [Re: ditty] | Copy to clipboard |
Posted by: kavinwang Posted on: 2004-11-02 09:05 ditty wrote: 你试过有用吗? |
7.Re:请教:LINUX下Console输出信息的清屏命令 [Re: xxg0621] | Copy to clipboard |
Posted by: littledeer1974 Posted on: 2004-11-02 09:13 I tried this in Linux runs well
|
8.Re:请教:LINUX下Console输出信息的清屏命令 [Re: littledeer1974] | Copy to clipboard |
Posted by: xxg0621 Posted on: 2004-11-13 17:08 谢谢! 为什么同样的程序把clear命令改成windows下的cls命令却不能在windows下运行? 请指教! |
9.Re:请教:LINUX下Console输出信息的清屏命令 [Re: xxg0621] | Copy to clipboard |
Posted by: qingbo777 Posted on: 2004-11-13 17:42 你试试在windows运行里打cls能直接运行么? 这就是你的程序在windows下不能运行的原因. 试着改成"cmd /k cls" 应该就可以了. |
10.Re:请教:LINUX下Console输出信息的清屏命令 [Re: qingbo777] | Copy to clipboard |
Posted by: xxg0621 Posted on: 2004-11-14 14:35 改成"cmd /k cls"就更不行了,我的程序如下,运行之后就会发生IOException,大侠帮我分析分析: import java.io.*; public class cls { public static void main(String[] args) { //clear the screen(for Windows System) try { Process process = Runtime.getRuntime().exec ("cls"); InputStreamReader ir=new InputStreamReader(process.getInputStream()); LineNumberReader in = new LineNumberReader (ir); String line; while ((line = in.readLine ()) != null) System.out.println(line); } catch (Exception e) { System.err.println ("IOException " + e.getMessage()); } System.out.println("Hello"); System.out.println("How are you!"); } } |
11.Re:请教:LINUX下Console输出信息的清屏命令 [Re: xxg0621] | Copy to clipboard |
Posted by: qingbo777 Posted on: 2004-11-15 12:04 sorry,我记错了.应该是"cmd /c cls". 另外,cmd是win2000或xp下的.如果是win98或nt的话,要改成command. 你可以用System.getProperty("os.name")来获取当前操作系统的名称,然后作进一步的选择. |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |