I am writing a simple Java project call Robot. The Robot can accept a config file from the command prompt (If there is not file, the robot will use the default config) by:
java Robot < config.txt
Does anyone know how I can read the redirect input from the command prompt in java?
You can access
System.inas an input stream, that will contain all redirected input.Specifically, reading from a redirected stdin is the same as reading from the regular stdin.
For example, let’s say you want to read a list of integers from a redirected stream.
Then when you run this, you’ll get