Search code examples
javaagents-jade

Jade jar in java + code


I am a beginner in JADE programming and I'm having problems running the JADE code in Java. Can someone help me in this??

I am using eclipse and I've added the jade jars, but when I try to run the JADE code it's not working.

import jade.core.Agent;

  public class HelloAgent extends Agent 
  { 
      protected void setup() 
      { 
          System.out.println("Hello World. ");
          System.out.println("My name is "+ getLocalName()); 
      }
  }

Solution

    1. Check whether you have the right version: JADE 4.0+ supports getLocalName(); command
    2. The code looks fine, you can have problem with Eclipse interfacing, check that.
    3. Anyways, you can manually (and recommended) to compile and execute to test:

      java jade.Boot -agents Agent1:HelloAgent // to exexute

    If this doesn't work then there is a problem with JADE installation