I've tried using \033[H\033[2J. and System.out.flush(); but so far, no luck
/**
* @param args the command line arguments
* @throws java.io.IOException
*/
public static void main(String[] args) throws IOException {
Scanner myObj = new Scanner(System.in);
System.out.println("Hello User,");
System.out.println("Please Enter Username");
String UserName = myObj.nextLine();
System.out.println("Welcome, " + UserName);
System.out.println("Please Enter Your Password");
String Password = myObj.nextLine();
if ("Vaska".equals(Password)){
//Clear Console
System.out.println("You Have Now Gained Access To The Program, Have Fun!");
}else{
//Clear Console
System.out.println("Sorry " + UserName + ", You Have Entered The Wrong Password, Please Restart The Application");
System.exit(0);
}
}
I've also tried using the System.getProperty() Method, but it always comes back as an error.