IntelliJ-从文件中获取标准输入 [英] IntelliJ - Take standard input from a file

查看:188
本文介绍了IntelliJ-从文件中获取标准输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从IntelliJ IDEA中的文件中获取标准输入.

I need to take standard input from a file in IntelliJ IDEA.

$ java BinarySearch tinyW.txt < tinyT.txt 

'tinyT.txt'是要用作标准输入的文件. "tinyW.txt"是另一个文件,作为命令行参数传递给程序.

'tinyT.txt' is the file which is to be taken as standard input. 'tinyW.txt' is another file which is passed as a command-line argument to the program.

如何通过IntelliJ来实现?

How can this be achieved through IntelliJ?

PS:由于未设置class-path变量,因此我不是从命令行运行此程序,而是使用外部库中的函数.

PS: I am not running this program from the command-line as the class-path variable hasn't been set, and I am using functions from external libraries.

推荐答案

您需要创建运行/调试配置"(菜单运行"->编辑配置...").

You need to create a "Run/Debug Configuration" (Menu "Run" -> "Edit Configurations...").

在配置面板中大约一半的位置是一个条目"Redirect input from",其前面有一个复选框.选中复选框后,您可以选择文件"tinyT.txt".

About halfway down in the configuration panel is an entry "Redirect input from" with a checkbox before it. After selecting the checkbox you can select the file "tinyT.txt".

必须在程序参数"字段中输入"tinyW.txt"

"tinyW.txt" has to be entered into the field "Program arguments"

这篇关于IntelliJ-从文件中获取标准输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆