且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Eclipse中的参数调用Java main方法

更新时间:2023-12-04 14:19:28

这个答案基于Eclipse 3.4,但应该在较旧版本的Eclipse中工作。

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.

在Java运行配置的参数选项卡上,配置变量$ {string_prompt}出现(您可以单击变量获取它,或复制直接设置它)。

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.