Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to clear screen

Posted on 2001-07-16
5
Medium Priority
?
4,032 Views
Last Modified: 2010-02-09
Dear friends,

  Can u tell me, how to clear screen in java console base programming. (In c or cpp there is clrscr(), like wise something in java)

------------------------------------------------

 I am using Windows 98 operating system . I try with  Runtime.exec("command /c cls") like--

class test
{
  test()
  {
    Runtime.exec("command /c cls");
  }
  public static void main(String []aa)
  {
    test t = new test();
    System.out.println("Hello");
  }
}

 but error is coming. error is -

  Can't make static reference to method java.lang.Process exec(java.lang.String) in class java.lang.Runtime.
 

  if u have any solution then pl tell me.


-suraj deo
0
Comment
Question by:surajdeo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Expert Comment

by:googlyralph
ID: 6285655
Due to the platform independance of Java im not usre you can. In the past i use a method that does println('') 's in a forloop, the controll for the loop being an argument to the method.

eg:

protected void clear(int lines){
   for(int x = 0; x < lines; x++){
      System.out.println('');
   }
}

GR.
0
 
LVL 15

Expert Comment

by:mohan_sekar
ID: 6285676
Hi,

   Try Runtime.exec("cls");

bye
0
 
LVL 6

Expert Comment

by:kotan
ID: 6292334
for NT
     Runtime.exec("cmd /c cls");

for Win95/98
     Runtime.exec("command /c cls");

for Unix
     Runtime.exec("clear");
0
 
LVL 5

Expert Comment

by:vemul
ID: 7669778
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- To be PAQ'ed and points refunded
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

vemul
Cleanup Volunteer
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 7714899
Per recommendation, points refunded and question closed.

Netminder
EE Admin
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question