Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Eclipse Indigo 中用 JAVA 编写了代码。我想从 Eclipse 内部的控制台运行该程序(即不使用 RUN 按钮)。因为我想要传递始终变化的参数,并且从“运行配置”设置参数非常乏味。有人可以帮我吗?
在运行配置中添加 string_prompt 作为程序参数。
${string_prompt} 如果你特别想要文件\文件夹,还有一个 file_prompt 和一个 folder_prompt。
这些可通过“运行配置”对话框的 (x)= 参数选项卡上的“变量”按钮获得。
参考:如何让 Eclipse 提示我输入命令行参数
您可以创建一个配置文件,将其作为“运行配置”中的唯一变量,然后进行相应的解析。或者您可以在每次运行程序时提示用户输入配置。您可能需要重新考虑如何开发此代码以适应此类变化。