我通常通过运行配置在Eclipse中输入命令行参数。但是我不知道如何在IntelliJ IDEA中实现同样的任务。
当前回答
自IntelliJ IDEA 2021年以来,我对这个问题添加了更新的答案。
Select Edit Configuration from the toolbar (or under the Run menu): Picture of new location of edit configuration box You now have to click on the Modify Options menu (Alt + M) to the left of where it says Build and Run, and above the drop down menu that lets you select the version of Java (or other language) that your using. After you click Modify Options the first box you will see--titled Operating System--will have a line that says "Redirect input". Click on that to add the box for input redirection. Close Modify Options. Under Build and Run, the third box down is for command line input.
Intelij IDE的图片与编辑配置框打开箭头指向cmd行输入和输入重定向
这就是它的全部。
其他回答
点击“编辑配置…”从工具栏顶部 在弹出窗口中,确保“环境”部分展开(通过单击下拉箭头) 应用程序的命令行参数应该进入“程序参数”字段
要在Windows 10上的IntelliJ IDEA 2020.2.3(社区版)中执行此操作:
ALT-SHIFT-F10 0 [TAB] 7次
2020年11月更新。
我有一个类Test:
然后。转到配置运行类Test:
步骤1:添加应用
步骤2:
您可以在“程序参数”文本框中输入参数。
Maytham -ɯɐɥah λɐɯ,你可以用这段代码来模拟输入文件:
System.setIn(new FileInputStream("FILE_NAME"));
或者将文件名作为参数发送,然后将其放入FileInputStream:
System.setIn(new FileInputStream(args[0]));
自IntelliJ IDEA 2021年以来,我对这个问题添加了更新的答案。
Select Edit Configuration from the toolbar (or under the Run menu): Picture of new location of edit configuration box You now have to click on the Modify Options menu (Alt + M) to the left of where it says Build and Run, and above the drop down menu that lets you select the version of Java (or other language) that your using. After you click Modify Options the first box you will see--titled Operating System--will have a line that says "Redirect input". Click on that to add the box for input redirection. Close Modify Options. Under Build and Run, the third box down is for command line input.
Intelij IDE的图片与编辑配置框打开箭头指向cmd行输入和输入重定向
这就是它的全部。
推荐文章
- 如何从终端/命令行调用VS代码编辑器
- 在Jar文件中运行类
- 如何在Windows命令提示符下运行.sh ?
- 如何查看IntelliJ中的编译错误列表?
- 如何从命令行通过mysql运行一个查询?
- 类未找到:IntelliJ中的空测试套件
- 如何从命令行在windows中找到mysql数据目录
- 如何从命令行安装cygwin组件?
- 如何更改Git日志日期格式
- 使iTerm以与其他操作系统相同的方式翻译“元键”
- Intellij IDEA Java类在保存时不能自动编译
- 如何合并2 JSON对象从2个文件使用jq?
- Android Studio中的。iml文件是什么?
- 如何触发命令行PHP脚本的XDebug分析器?
- Rust中的默认函数参数