如何使IntelliJ提示我命令行参数 [英] How to make IntelliJ prompt me for command line arguments

查看:756
本文介绍了如何使IntelliJ提示我命令行参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse中,您可以在运行配置中提供程序参数 $ {string_prompt} ,以提示输入命令行参数。

In Eclipse, you can provide the program argument ${string_prompt} in your run configuration to have it prompt for the command line arguments.

在IntelliJ中有办法做到这一点吗?

Is there a way to do this in IntelliJ?

推荐答案

编辑:



这可能是IDEA中的一个错误,我首次发布的解决方案(您可以看到它)导致Intellij在输入参数后挂起。

This may be a bug in IDEA, the solution that I first posted (you can see it below) causes Intellij to hang after entering parameter.

我无法想出一个灵魂,但这里有一个小技巧:你可以滚动到运行/调试配置屏幕的最底部,在之前

I couldn't come up with a soultion to this, but here's a little trick: you can scroll to the very bottom of Run/Debug configuration screen and in "Before launch" section check a checkbox saying "Show this page".

从现在开始,您会在自动显示配置屏幕时选择显示此页面复选框。运行/调试你的应用程序,你可以输入任何你想要的参数...这不舒服,但至少更自动化。

From now on you'll be automatically shown configuration screen when you choose to Run/Debug your application and there you can enter any parameters you want... It's not that comfortable, but at least a little bit more automatized.

Intellij:这更复杂一点:

This is a bit more complicated with Intellij:


  • 转到设置 - >外部工具 - >在中添加(绿色加)

  • 参数行单击插入宏 - ;提示(您也可以直接输入 $ Prompt $

  • 保存设置

  • 转到运行 - >编辑配置...

  • 中启动前部分选择运行外部工具并选择您创建的工具

  • go to Settings -> External Tools -> Add (green plus)
  • in Parameters line click Insert macro -> Prompt (you can simply type in $Prompt$ as well)
  • save settings
  • go to Run -> Edit Configurations...
  • in Before Launch section choose Run External Tool and select tool that you've created

这应该足够了(适用于IDEA 12.1.6)。

That should suffice (works in IDEA 12.1.6).

这篇关于如何使IntelliJ提示我命令行参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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