我通常通过运行配置在Eclipse中输入命令行参数。但是我不知道如何在IntelliJ IDEA中实现同样的任务。


当前回答

Windows、Linux和部分mac电脑:

ALT+SHIFT+F10,右,E, Enter, Tab,输入你的命令行参数,Enter。: -)

Mac的“OS X 10.5”键模式:

CTRL+ALT+R,右,E, Enter, Tab,输入你的命令行参数,Enter。

其他回答

如果你正在使用intellij去运行>编辑配置菜单设置。将出现一个对话框。现在您可以向Program arguments输入字段添加参数。

做以下步骤:-

进入运行-编辑配置->应用程序(在面板左侧)->选择你想要运行的scala应用程序->程序参数

Windows、Linux和部分mac电脑:

ALT+SHIFT+F10,右,E, Enter, Tab,输入你的命令行参数,Enter。: -)

Mac的“OS X 10.5”键模式:

CTRL+ALT+R,右,E, Enter, Tab,输入你的命令行参数,Enter。

自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行输入和输入重定向

这就是它的全部。

用空格分隔多个程序参数。(这对我来说并不明显)

节目论证:茱莉亚52女演员