Pure Java
You can redirect System.in with a single line of code:
System.setIn(new FileInputStream(filename));
See System.setIn().
Eclipse config
In Eclipse 4.5 or later, the launch configuration dialog can set System.in to read from a file. See the announcement here.
More Related Contents:
- Eclipse – Show generated class files
- In Java, how do I parse XML as a String instead of a file?
- Eclipse: How to build an executable jar with external jar?
- Break when exception is thrown
- Why does Eclipse complain about @Override on interface methods?
- Why is JavaFX is not included in OpenJDK 8 on Ubuntu Wily (15.10)?
- How do I add a resources folder to my Java project in Eclipse
- Browse for image file and display it using Java Swing
- JBoss debugging in Eclipse
- Cannot change version of project facet Dynamic Web Module to 3.0?
- “The public type must be defined in its own file” error in Eclipse [duplicate]
- How to read a file from a jar file?
- java.lang.OutOfMemoryError: PermGen space [closed]
- java.lang.NoSuchMethodError in Flink
- What does Maven Update Project do in Eclipse?
- Maven Java Version Configuration ignored by Eclipse/Idea
- Strings written to file do not preserve line breaks
- Getting the last modified date of a file in Java
- adding progress bar to each table cell for file progress – Java
- “Faceted Project Problem (Java Version Mismatch)” error message
- Where is the correct location to put Log4j.properties in an Eclipse project?
- How to suppress Java warnings for specific directories or files such as generated code
- How to use Special Chars in Java/Eclipse
- JavaFX Maven Plug-in: No plugin found for prefix ‘jfx’ in the current project and in the plugin groups
- Why “no projects found to import”?
- Unable to connect to database (No suitable driver found)
- What different breakpoint icons mean in Eclipse?
- Any way to generate ant build.xml file automatically from Eclipse?
- What’s the fastest way to read from System.in in Java?
- How to disable TestNG test based on a condition