Clearing the screen in a console program....?

why is it that you can type 'cls' in dos and instantly clear the screen and yet there is no (or at least none that I've come across) equivalent command in java?
anybody...?
Thanks.

http://search.java.sun.com/Search/java?col=javafrm&qp=&qt=clear+screen

Similar Messages

  • How do I clear the screen in console application?

    In C or C++ we can clear the screen by clrscr() function.
    How can I acheive something similiar to this in Java

    Hi,
    Take a look at the below link may help you
    http://www.codeguru.com/forum/archive/index.php/t-323058.html
    This forum is exclusively related to discussions about Sun java Studio Creator. Henceforth please post these threads to an appropriate forum.
    MJ

  • How to clear the screen in the command prompt?

    Hello Everyone,
    I was wondering how we can clear the screen in the command prompt in Java. I remember we can do this in C by writing system("cls");
    What is the best IDE for writing Java programs. Is the NetBeans IDE good? Thank you very much.

    I was wondering how we can clear the screen in the
    command prompt in Java. I remember we can do this in
    C by writing system("cls");I guess there's no Java way of doing that because it's a function of the shell you're calling. If you try to use Runtime.exec on cls, it starts yet another shell, clears that, and closes it again, so it has no effect on your output.
    You could try using the '\b' backspace character, if that helps.
    What is the best IDE for writing Java programs. Is
    the NetBeans IDE good? Thank you very much.By the way you're asking this question, the answer will be almost certainly "none". If you want to, you can search this board for the few million times this question was asked before, pick all IDEs suggested there and use the one you're most comfortable with.

  • Does anybody know how to Clear the screen in Java?

    Hi guys,In C we use System Clear.
    In java,which instructions shall i use in order to clear the screen?
    Thanks,in advance!

    Of course you shouldn't do so anyway...
    Terminal programs should coexist with all other terminal programs and not try to dominate the screen.
    They should never clear the screen as this would remove output from other programs running in the same terminal.

  • How do I clear the screen in text mode (cls)

    How do I clear the screen in text mode (cls)
    Thanks,

    Clearing of console is an OS specific command, so
    in case of Windows you should try:
    Runtime.getRuntime().exec("cls");Though it wouldn't help, because exec() will be done as a separate
    process... :)
    Paul

  • How i can clear the screen in JAVA?, in c++ is  command that called .......

    system("cls")
    but in JAVA??
    thx
    gicio1

    system("cls") is the silly way to do it. For a start, "cls" isn't on most computers, because most computers call it "clear". You could run this from Java using Runtime.exec("clear"), Runtime.exec("cls"), etc .. but the best way to clear the screen is still to print out N newlines, where N is the height of the screen.
    The only problem with this way is, you don't know the height of the screen. You could pass an environment variable in as a system property, from whatever launches your program, and if it's not there "assume" it's 200 or something. Then just build up a string with "\n\n\n\n\n\n\n\n"... and print it out. Blam, blank screen. :-)

  • Clearing the screen

    I realize this has probably been covered before but how do you clear the screen of previous lines of code?
    I am using Crimson Editor and the latest SDK and running programs in a DOS shell.
    Please let me know how to do it, if it is a DOS command how to implement into my program and if a java method what the parameters are.
    Thanks.

    If you are wanting to clear the DOS window, there is no provision in Java for that. You could output new lines from your program and force the data on the screed to scroll off.
    The DOS command to clear the screen is "cls" and you will need to use runtime method. Search the forums for that method, there are literally hundreds of posts on the subject. The search is in the upper right corner.

  • Clearing the screen in dos?

    I am executing my programs in DOS and I was wondering if there was a way to clear the screen. I was hoping that this did not involve having JAVA execute DOS commands... But if that is the case, then how do you do that?
    Thanks

    By "the screen" I assume you mean the DOS box where you typed your "java ..." command? If so, the easiest way is to have your Java program execute System.out.println(""); 24 times in a row, or however many times it takes to make it blank. The next time the program writes output, though, it will be at the bottom of the screen. If you don't like that, are really anal, and have nothing better to do you can do some JNI (Java Native Interface aka C++) programming to fix that.

  • Clearing the screen using java

    hi
    how to clear the screen using a java program

    for (int n = 0; n < 24; n++) System.out.println();
    Even better: don't clear the screen. The program I ran before your program printed out very important things. If your program throws away those important things then I will not like you or your program.

  • How to clear the screen in java?

    Hi,
    How to clear the screen in java without using any loops?
    Thanks

    Just paint with your background color to let the old paintings vanish.

  • Clearing the Screen in Xcode C

    Freinds:
    I am studying C using the Xcode standard application tool. Can someone list for me or e-mail me or pst here some code I can use to clear the screen in the simple "hello world!" application below?
    #include <stdio.h>
    int main (int argc, const char * argv[])
    printf("Hello, World!\n");
    return 0;
    Thanks in advance,
    Miguel Reznicek

    Basic C I/O is designed for a very basic command line. It won't do anything more than print. You could do something like:<pre>
    void clr()
    int i;
    for(i = 0; i < 100; ++i)
    printf("\n");
    }</pre>
    It isn't pretty, but it will always work.
    If you wanted to be a little more fancy and clever, you could access the terminal escape codes directly.<pre>
    void clr()
    printf("\033[2J");
    }</pre>
    The problem with this method is that it is dependent on your particular terminal. This example is supposed to work with an ANSI terminal. You may have to fiddle with it to get it to work. If you wanted to be really clever, you could find out what terminal you are using programatically, query the termcap database for the clr escape code, and print that. That's going to be pretty hard though.
    Another option would be to use the curses library. The best I can do for you here is to just post a link to the ncurses man page. Ncurses is a very powerful library and should do exactly what you need. It is essentially a library that does exactly what I mentioned before about querying the termcap database based on your particular terminal. I used an old MacOS version years ago. Once you figure out the basics, it is easy.

  • Is There a Way to Clear the Screen ???

    I am building a Class that is text (command line) based. Is there anyway to clear the screen (output) in such a class.
    Similar to what CLS does in DOS...

    See my response here:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=317191

  • How do I clear the screen?

    Hello,
    I would like to know how to clear the screen. What is the code for it?
    Ernest_E

    Hi,
    Look to the left. There is a search field there. This question is often asked. The short answer is that you can't do it.
    /Kaj

  • How do I clear the Screen Saver?

    How do I clear the Screen Saver from showing the photos on my phone?

    You must have set it to use your photo stream as the screensaver. You can go into settings - screensaver to change to a different source.

  • Clearing the screen, and special characters

    First off, I want to be able to clear the screen between menu selections. I've been told it's hard, but I don't mind, and I DON'T want to just print a whole heap of lines...
    Second, How can I print special "High ASCII" characters, specifically the ones that are used in DOS borders around menus and windows. Unicode values from 2500 - 256C (Hex)
    Ta muchly,
    -Phil-

    It sounds like you want a CURSES library for java. This seems to be a rare thing since once people are willing to go to the effort of using curses, they just use AWT or Swing instead. But I've seen CURSES libraries out there. Try Google.
    If the DOS extended characters are really part of Unicode, then just print out the relevant characters. You can use Unicode escape sequences (\u0000) to do so. This assumes that the terminal can handle them, which it may not.
    You could just print out the terminal escape sequences to clear screen and position the cursor yourself, I suppose, but a CURSES library would probably be more portable.

Maybe you are looking for

  • How do I edit and create new Spry2 menu items?

    I have manged to use adobe air to style and insert a spry2 menu - looks OK However,I do not undestand how to edit the menu items i.e. creating new menu items and adding new sub menu items On spry1 it was easy - just click the top of the menu and a wi

  • Having trouble connecting Western Digital My Book Home Edition 2.0 external hard drive to macbook pro 10.6.8.

    If I try to connect via firewire I get nothing.  If I connect via usb, computer says its not readable and gives me an option to initialize, but disk utilities wont carry out any actions.  to repair or erase.

  • Preferred import workflow for FCP X?

    I'm still a little puzzled by the new approach to importing. I support the X overhaul, but I just want to grab footage from CF cards, store it on my Video drive, then reference it in the projects. I dont care much for the iPhoto-style 'Events', but a

  • Format of the parallel port base address

    Just wondering if someone could please help with what I'm sure is a simple question I'm currently trying the control the first 3 bits of the parallel port using the Out Port sub vi. Using the Labview examples and help I can see how to find the base a

  • Need QUICK! help for Quicktime Pro Install

    I came in this morning knowing I'd be pressed for time, and that I needed to convert a WMA file to an MP3 for a meeting. I decided to use Quicktime Pro 7. I made the purchase and have been trying for a 45 minutes of precious time to get it installed