java - 非常简单的翡翠问题(严重:无法创建代理)
问题描述
首先,我不知道我在做什么,我没有任何 Java 知识
我看到了这些主题,但我不明白如何应用这些解决方案。
AgentPing<<<这是我的 ping
package project;
import jade.core.*;
import jade.core.behaviours.*;
import jade.lang.acl.ACLMessage;
public class AgentPing extends Agent{
protected void setup(){
addBehaviour (new CyclicBehaviour(this){
public void action(){
ACLMessage msg = receive();
if(msg == null) {
ACLMessage sending_msg = new ACLMessage(ACLMessage.INFORM);
sending_msg.addReceiver(new AID("agentPong",AID.ISLOCALNAME));
sending_msg.setContent("Ping");
send(sending_msg);
if(sending_msg!=null)
System.out.println("message sent successfully");
block(3000);
}
else {
System.out.println("message responded by " + msg);
block(3000);
}
}
});
}
}
AgentPong<<<这是我的Pong
package project;
import jade.core.*;
import jade.core.behaviours.*;
import jade.lang.acl.ACLMessage;
public class AgentPong extends Agent {
protected void setup() {
addBehaviour(new CyclicBehaviour(this){
public void action() {
ACLMessage msg = receive();
if(msg == null) {
block();
}else {
System.out.println(myAgent.getLocalName()+" <- "+ msg.getContent()+" from " + msg.getSender().getName());
ACLMessage reply_msg = msg.createReply();
reply_msg.setPerformative(ACLMessage.INFORM);
reply_msg.setContent("Pong");
send(reply_msg);
if(reply_msg!=null) {
System.out.println("message sent successfully");
block();
}
}
}
});
}
}
在运行配置窗口中
我在“项目”部分写了项目在主类部分我写了jade.Boot
在 Arguments 我写了“-gui ping:AgentPing;pong:AgentPong”
在我的“运行配置”窗口中,我没有类路径部分我有“依赖项”
我还在我的项目文件夹中构建路径 Jade.jar。
但我总是有
严重:无法创建代理 ping:找不到代理的类 AgentPing (agent-identifier:name ping@192.168.1.38:1099/JADE) [嵌套 java.lang.ClassNotFoundException: AgentPing]
严重:无法创建代理 pong:找不到代理的类 AgentPong (agent-identifier:name pong@192.168.1.38:1099/JADE) [嵌套 java.lang.ClassNotFoundException: AgentPong]
错误。
我无法弄清楚这个问题,如果我解决了这个问题,我必须为简单的买卖双方算法做谈判程序。我需要即时帮助:/
解决方案
推荐阅读
- java - 为什么表关联没有在休眠中添加左外连接
- c# - 在 c# 中使用 socket.io 连接到 node.js 服务器
- python - 以编程方式分配 Locust 任务集
- etl - girdDB|NiFi PutDatabaseRecord 错误:无法设置类型 4 的索引 1
- mongodb - mongodb如何在给键时查询至少有N键的记录?
- linux - 如何从历史中恢复一个非常古老的命令?
- javascript - 使用 Cloud Functions 和 Nodemailer 发送电子邮件
- apache-spark - 如何在蜂巢中将两列连接到地图中
- python - TypeError:DecisionTreeClassifier() 不是估算器实例
- java - IntelliJ Idea 社区版使用过多内存