JADE action()不起作用 [英] JADE action() not working

查看:87
本文介绍了JADE action()不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为我的项目中缺少一些东西。我需要代理来执行我分配的特定任务。我正在使用JADE。在 action()内,我编写了一个for循环以显示数字1到10。运行时未显示任何错误,并且该循环也未执行。当我运行时:

I think I am missing something in my project. I need agents to perform specific task that I assign. I am using JADE. Inside the action() I wrote a for loop to display numbers 1 to 10. While running no error is showing and also the loop is not getting executed. When I run:

java -cp jade.jar jade.Boot -gui agent:TestAgent

我收到 classNotFound 异常,并显示无法创建代理。

I get a classNotFound Exception and also shows agent can't be created.

当我运行时:

java -cp jade.jar jade.Boot -gui -agent agent:TestAgent

我已经准备好代理信息,但是操作方法是

I get info as agent ready, but the action method is not getting called.

可能是什么原因?我该怎么办?

What may be the reason? what should I do?

推荐答案

尝试在IDE中运行玉器。
如果使用netbeans,则可以转到Project Properties-> Run:
主类:jade.Boot
参数:-gui agentName:packageName.AgentClassName(如果使用的是默认软件包)使用:agentName:AgentClassName)

Try to run jade in your IDE. If you use netbeans, you can go to Project Properties -> Run: Main Class: jade.Boot Arguments: -gui agentName:packageName.AgentClassName (if you are using the Default Package use: agentName:AgentClassName)

您是否在 setup()函数中将您的行为添加到TestAgent中?
您可以使用 addBehaviour(new myBehaviourClassName())

Are you adding your Behaviour to your TestAgent in the setup() function? You can do it using addBehaviour(new myBehaviourClassName())

您不应该再做的一件事而不是在代理或行为中使用循环函数(至少不是大循环),而使用循环行为(或 done()函数中具有循环停止条件的SimpleBehaviours)并使用拥有行为的代理来保存信息,您只需在 action()函数中处理循环的一次或几次迭代即可。

One more thing you shouldn't use loop functions in agents or Behaviours (at least not big loops), use cyclic Behaviours (or SimpleBehaviours with the loop stop condition in the done() function) instead and use the agent that owns the Behaviour to save the information you need to process only one or a few iterations of your "loop" in the action() function.

如果要从命令行运行玉器,请使用 java jade.Boot -gui agentName:TestAgent
它将启动您在主容器中的代理商。
如果遇到找不到类错误,请在cmd中检查当前路径,它应该是 projectPath\build\classes (至少在Netbeans项目中,如果您使用的是其他IDE,则路径可能会不同)。

If you want to run jade from the command line use java jade.Boot -gui agentName:TestAgent it will launch your agent in the main container. If you are getting a class not found error check your current path in the cmd, it should be projectPath\build\classes (at least in a Netbeans Project, if you are using another IDE the path may be different).

这篇关于JADE action()不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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