首页 > 解决方案 > 非常简单的翡翠问题(严重:无法创建代理)

问题描述

首先,我不知道我在做什么,我没有任何 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]

错误。

我无法弄清楚这个问题,如果我解决了这个问题,我必须为简单的买卖双方算法做谈判程序。我需要即时帮助:/

标签: javaeclipseagents-jade

解决方案


推荐阅读