Reputation: 569
Is there anyway to set up an IntelliJ run config for a Java program, so that it runs as if I ran this in terminal:
java Uguu < file
How would I tell IntelliJ to put the <
file part?
Upvotes: 3
Views: 1048
Reputation: 1989
You can use this code to simulate input of file:
System.setIn(new FileInputStream("FILE_NAME"));
Or send file name as parameter and then put it into FileInputStream:
System.setIn(new FileInputStream(args[0]));
Upvotes: 0
Reputation: 97133
IntelliJ IDEA's run configurations do not support input redirection. Please consider modifying your program so that it can accept a file name as a command line parameter and read from that file, instead of reading from the standard input.
Upvotes: 4
Reputation: 549
Try Run -> Edit Configurations... -> Tab "Configuration" -> Program arguments
Upvotes: 0