Results 1 to 2 of 2
  1. #1
    Jey is offline Member
    Join Date
    Aug 2011
    Czech Republic
    Rep Power

    Default system("cls") in Java?

    Hi, this thread probably exists, but not good answers for me. How can I clear screen in Java? Im using NetBeans and his output.

    Thanks for your response.

  2. #2
    kammce's Avatar
    kammce is offline Senior Member
    Join Date
    Dec 2010
    Rep Power


    Are you clearing your terminal/console/Command-prompt or some sort of GUI Interface.

    If you are talking about your terminal/console/Command-prompt, then there are many ways to do this depending on the OS and how your implement this.

    For example, In Linux you could just do this.
    Java Code:
    There is a command in linux that does this already. I bet there is one for Windows as well... I think there is a clear program on windows as well but I am not too sure. If using external programs is not your cup of tea then this should work for you!
    Java Code:
    public class Clear {
    	public static void main(String args[]) {
    	final String clear = "\033[";
    		System.out.print(clear + "2J"); System.out.flush();
    My API:
    Java Code:
    cat > a.out || cat > main.class

Similar Threads

  1. Replies: 14
    Last Post: 08-07-2011, 09:25 AM
  2. Java, Military Format using "/" and "%" Operator!!
    By sk8rsam77 in forum New To Java
    Replies: 11
    Last Post: 02-26-2010, 03:03 AM
  3. System.out.println("Hello Java-Forums!");
    By Arsenic in forum Introductions
    Replies: 0
    Last Post: 03-05-2009, 05:39 PM
  4. System.setProperty("http.agent"..) appends Java/1.6
    By wwuster in forum Advanced Java
    Replies: 1
    Last Post: 10-25-2008, 03:20 PM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts