Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Need a "cls/clear" instruction

  1. #1
    Junior Member
    Join Date
    Jun 2013
    Location
    Costa Rica
    Posts
    4
    My Mood
    Worried
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need a "cls/clear" instruction

    I need a clear instruction like consoles "cls" (windows) and "clear" (linux) instruction.
    Runtime.getRuntime().exec("clear");
    doesn't work.

    Console error at program:
    Exception in thread "main" java.io.IOException: Cannot run program "clear": CreateProcess error=2, El sistema no puede encontrar el archivo especificado
    	at java.lang.ProcessBuilder.start(Unknown Source)
    	at java.lang.Runtime.exec(Unknown Source)
    	at java.lang.Runtime.exec(Unknown Source)
    	at java.lang.Runtime.exec(Unknown Source)
    	at comparator.main(comparator.java:15)
    Caused by: java.io.IOException: CreateProcess error=2, El sistema no puede encontrar el archivo especificado
    	at java.lang.ProcessImpl.create(Native Method)
    	at java.lang.ProcessImpl.<init>(Unknown Source)
    	at java.lang.ProcessImpl.start(Unknown Source)
    	... 5 more

    Class code:

    import java.io.IOException;
    import java.util.Scanner;
    // using basic phone specifications and features I realized that an if or a scanner can work for this java application
     
    public class comparator {
     
    	public static void main(String[] args) throws IOException {
    	String sdcard;
    	Scanner entrys = new Scanner(System.in);
    	// declaring variables
    	System.out.println("Enter the processor you need.");
    	int processors = entrys.nextInt();
    	boolean processorjudgement = (processors >= 2);
    	boolean processorjudgement2 = (processors <= 4);
    	Runtime.getRuntime().exec("clear");
    	System.out.println("Enter the RAM you need.");
    	int ram = entrys.nextInt();
    	Runtime.getRuntime().exec("clear");
    	double androidversion = entrys.nextDouble();
    	Runtime.getRuntime().exec("clear");
    	// declaring entrys methods
    	if (processorjudgement = true) {
    		System.out.println("Processor is powerful but dual-core processors gets lag on Android system, if you want a free lag phone, consider a quad-core");
    		}
    	}
     
     
    	}
    If asking about it, just an Android phone features program, description at comments.


  2. #2
    Junior Member
    Join Date
    Jun 2013
    Location
    Costa Rica
    Posts
    4
    My Mood
    Worried
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Need a "cls/clear" instruction

    Anyone knows?

  3. #3
    Junior Member
    Join Date
    May 2013
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Need a "cls/clear" instruction

    Doing quick research, I came across Java Curses Library | Free software downloads at SourceForge.net . This forum Clear the Screen - Java talks at length about other methods, but it depends on the platform.

Similar Threads

  1. How would you add a list of "events" and "tasks" to their respective arrays?
    By LIboy1027 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 19th, 2013, 07:32 AM
  2. Conceptual Questions Related To "super" keyword and "constructor".
    By wikki2013 in forum Java Theory & Questions
    Replies: 1
    Last Post: May 26th, 2013, 03:14 PM
  3. Replies: 3
    Last Post: December 7th, 2011, 02:03 AM
  4. Replies: 7
    Last Post: August 13th, 2011, 02:22 AM
  5. "java.lang.NoSuchMethodError: main" and "fatal exception occured."
    By joachim89 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 10th, 2010, 08:35 AM

Tags for this Thread