如何将控制台参数传递给eclipse中的应用程序? [英] How to pass console arguments to application in eclipse?

查看:215
本文介绍了如何将控制台参数传递给eclipse中的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在批处理文件中有以下行。



java客户端127.0.0.19876 / p>

它包含我的java类和两个参数的名称。我的应用程序需要这些参数才能正常运行。



在eclipse中运行应用程序时是否有任何方法传递这些参数?这将使调试更容易。当然,我可以通过使用代码中的参数的值来解决问题,但我很好奇。

解决方案

只需点击运行图标,选择旁边的下拉框,然后选择运行配置。找到您的应用程序(或为其创建运行配置),并将命令行参数放在参数选项卡中。有关详细信息,请参阅文档。它应该是这样的:




I have the following line in a batch file.

java Client "127.0.0.1" 9876

It contains the name of my java class and two arguments. My application requires these arguments to run properly.

Is there any way to pass these arguments when running the application in eclipse? It would make debugging a lot easier. Of course I could resolve the problem by using the values of the arguments in the code but I'm curious.

解决方案

Instead of just hitting the "Run" icon, select the dropdown box next to it, and choose "Run Configurations". Find your application (or create a Run Configuration for it) and put the command line arguments in the "Arguments" tab. See the docs for more information. It should look like this:

这篇关于如何将控制台参数传递给eclipse中的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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