"Never memorize something you can look up", Albert Einstein

AOP JADE configure in Eclipse and NetBeans

This week we started again with school and one of the new lessons we follow talks about Agent Oriented Programming. With Java Agent Development Framework (JADE) we had to show a ‘Hello World’, well getting this to work was less easy than we imagined, so here a small guide with screenshots how we did it.

  1. Download JADE
    http://jade.tilab.com/
    Tip: If you don’t want to create an account like me, go to bugmenot.org for a valid login.
  2. Download the complete package
    it’s only 12MB :p
  3. Extract the JADE-bin-4.0.1.zip
  4. Open Eclipse or NetBeans
  5. Start a new Java-project
  6. Create the following file
    package helloworld;
    
    import jade.core.Agent;
    
    public class Hello extends Agent {
    	
    	protected void setup() 
        { 
            System.out.println("Hello World. ");
            System.out.println("My name is "+ getLocalName()); 
        }
    	
    	public Hello() {
    		System.out.println("Constructor called");
    	}
    }
    

    Note: Mind the package.. and classname

     

  7. Set configuration in Eclipse/NetBeans

In Eclipse

Add the library’s to your project as in the following screenshots:

Add library's in Eclipse project
Add library's to build order

Adjust the Run-configuration as in the following screenshots:

Open run configuration
Set run configuration
Set parameters

In NetBeans

Set run configuration

So what is done?

Well the idea with AOP is that Agents are classes that can perform certain tasks in the whole system. So when the application is started it needs to boot jade.Boot to initialize it’s container for containing Agents and letting everything communicate with eachother. But for jade.Boot to know what Agents to load on boot you add an extra pair of parameters: (With the NetBeans example)

japie:aop.HelloAgent
[agentName]:[packageName].[className]

So you tell jade.Boot to create a new agent with an agent name ‘japie’ (this can be anything) to be added based on the code in the package aop and the class called HelloAgent.

 


Only members are allowed to post a comment.

Comments

No comments have been placed.