Using try(Scanner scan = new Scanner(System.in)) { } is causing
try(Scanner scan = new Scanner(System.in)) { }
Exception in thread \"main\" java.util.NoSuchElementException
Have you tried not using the try?
String username; String password; Scanner scan = new Scanner(System.in); System.out.print("Enter Username: ");