The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


JNI Perhaps?

Posted by Bill Venners on April 21, 2000 at 10:28 AM

> I am trying to find out how to clear an msdos screen using java
> In c++, there was a function called clrscr() which used to serve
> this purpose - java does not seem to have anything similiar.
> I have looked everywhere for a solution, and tried many different
> suggestions none of which work.
> For was suggested to use ANSI terminal sequences,
> but this failed..
> also tried the following -
> Runtime r = Runtime.getRuntime ();
> Process p = r.exec ("cmd /c cls");
> but what this was doing was clearing another thread - not the
> main one i was working on.
> I need a way of using the above to clear the main thread, or some
> alternate suggestion of a solution that ppl might be aware of.
> This is an urgent issue and would appreciate any and all assistance.
> rgds.

If you are not concerned about platform independence, which
your question seems to imply (since you are talking about
MS-DOS boxes), why not just call a native method that does
your trusty old C++ clrscr()? To figure out how to do this,
look for documentation at on JNI. I don't have
anything significant about JNI here at, so I'd just
do a search at for JNI (Java Native Interface).


  • Re:Jni Allan Cahill April 24, 2000 at 10:43 AM (2)
    • stdio.h vicky March 02, 2001 at 4:19 PM (1)
      • stdio Matt Gerrans November 20, 2001 at 1:02 PM (0)

Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us