私は次のようなユーザー入力を求めるプログラムを作成しました。
System.out.println("Where would you like the output file to end up? (full path and desired file name): ");
Scanner out_loc = new Scanner(System.in);
output_loc = out_loc.nextLine();
..。
System.out.println("Hey, please write the full path of input file number " + i + "! ");
System.out.println("For example: /home/Stephanie/filein.txt");
Scanner fIn = new Scanner(System.in);
この方法で何度か入力を求めますが、入力を間違えると、プログラムを強制終了して再実行する必要があるため、非常に苦痛になる可能性があります。プログラムを実行するときに一度にすべての入力を取得する簡単な方法はありますか?実行するときにコマンドラインで宣言するのと同じように?
java -jar /home/Stephanie/NetBeansProjects/cBelow/dist/cBelow.jar -userinputhere?