How do I use IntelliJ to run a program with a redirect symbol?

The core of the

problem is redirecting symbols

on the command line, I can execute the program like this:

java-cp / classpath MyClass < data.txt

that is, compile the MyClass.class bytecode file into binary code and run it, and then redirect data.txt to the program. The
program runs normally.

but the problem arises when I use Intellij.
according to idea/2016.2/run-debug-configuration-application.html" rel=" nofollow noreferrer "> official help I can only enter parameter names in Program Argument. If I enter a redirect symbol, it will cause an exception to be thrown

Exception in thread" main "java.lang.IllegalArgumentException .

is there any way to add redirection to a program in IntelliJ? Please!

= about "then why don"t you just run it on the command line? Bitches are hypocritical! " =
because I want to debug the program.

= about "then why don"t you just debug with jdb on the command line? Bitches are hypocritical! "
jdb this kind of thing Oracle officials do not bother to promote, beg to let it go.


remember that the subject is to debug the program, so there is another way:
run on the command line, and add
-Xdebug-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=4004
(the middle parameters must be copied and pasted, anyway, it is to open debugging, open port 4004)
and then IDEA runs where there is a remote, equipped with a port.
the command line runs, the program will stop and wait for the connection, and the remote debug run in IDEA can be connected to debug.
(PS: I don't know what happens when the two sides of the code are different)

can only think of a curvilinear way to save the nation:
if the subject reads the command line with Scanner,
directly new Sacnner (new File ("...")) That's it

by the way, IDEA is already setting parameters here, and redirecting files into them is no longer a parameter.


now (2019.4) the latest version of IDEA has added this feature.


encountered the same problem. I was learning the code on algorithm 4 edition and testing it, and then looking for ways to change the small source code in the book, because the command line is a little troublesome to run (Intellij IDEA is so easy to use). Finally, a method is found: put the file path in the parameters of the test, and then add an operation to read the file to the standard input stream before the test code.

        FileInputStream input;
        try {
            input = new FileInputStream(args[0]);
            System.setIn(input);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-7b7192-1576e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-7b7192-1576e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?