Invoking Java main method with parameters from Eclipse

后端 未结 6 846
终归单人心
终归单人心 2020-11-28 05:59

During development (and for debugging) it is very useful to run a Java class\' public static void main(String[] argv) method directly from inside Eclipse (using th

6条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 06:29

    This answer is based on Eclipse 3.4, but should work in older versions of Eclipse.

    When selecting Run As..., go into the run configurations.

    On the Arguments tab of your Java run configuration, configure the variable ${string_prompt} to appear (you can click variables to get it, or copy that to set it directly).

    Every time you use that run configuration (name it well so you have it for later), you will be prompted for the command line arguments.

提交回复
热议问题