JADE action() not working

让人想犯罪 __ 提交于 2019-12-24 08:29:07

问题


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

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

When I run:

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?


回答1:


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)

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

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.

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).



来源:https://stackoverflow.com/questions/15425624/jade-action-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!