Clearing the screen

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tiktik
    New Member
    • Nov 2008
    • 14

    Clearing the screen

    Hey there...

    I know that Java does not have a specific command which clears the screen, however I was wondering whether there exists some simple commands/coding which would have the same result.

    any ideas pls?
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    If you are working in a Windows environment, you can execute the "cls" command. If you are working in a Linux environment, you can execute the "clear" command. If you are working in another environment, you can look up the appropriate command line function that clears the screen and execute it.

    Be aware that using commands that are OS-specific means that your code will no longer be portable.

    Comment

    • Nepomuk
      Recognized Expert Specialist
      • Aug 2007
      • 3111

      #3
      Of course, you can always just print 1000 or more new lines. That should clear the screen and is OS independent - it would just be problematic with a very big screen, as there is no OS independent way I now of to test, how many lines the screen can display.

      Greetings,
      Nepomuk

      Comment

      Working...