Tutorial 1: Getting Started with JADE

[revised for JADE 2.5 March 2002]

(Note: The procedures in these notes have been tested on Windows 98 and Windows 2000.)

JADE can be run in several different ways, on one or on many computers. The easiest way is to run a single Jade platform on one computer and use the main container.

Once you have unzipped JADE, you need to make Jade's jar files visible on the classpath. To save typing out could make a one line batch file with the following (on a single line), tailored to your setup,

  • java -classpath .;.\lib\jade.jar;.\lib\jadeTools.jar;.\lib\iiop.jar;.\lib\base64.jar jade.Boot %1 %2 %3 %4 %5 %6 %7 %8 %9
  • We will call this batch file runjade.bat.

  • Booting Jade
  • Then boot Jade (from the jade directory),

    runjad -gui

    You see this window (after you display the tree),

    Notes on this image

    Running Some Agents

    We will use the DummyAgent which can be launched by clicking a button on the RMA, and the PingAgent which is an example provided with the Jade distribution. First you need to compile the PingAgent.

    Compiling the PingAgent

    The source for the PingAgent is in the src\PingAgent directory. I moved it to examples\PingAgent\ under the jade directory. This directory structure matches the package structure declared in the PingAgent.java source file.

    You need to compile the PingAgent. I find it convenient to use another one line batch file for compilation (from the Jade directory). The one line might be:

    javac -classpath .\lib\jade.jar;.\lib\jadeTools.jar;.\lib\iiop.jar;.\lib\base64.jar;. %1 %2 %3 %4 %5 %6 %7 %8 %9

    (all on one line)

    I call this file compilejade.bat.

    Then compile the Ping Agent with,

    compilejade examples\pingagent\*.java

    Loading the PingAgent into a Jade main container

    There are two ways to load agents, using RMA, and from the command line when booting JADE.

    Loading agents with the RMA

    In the RMA window, select Main-Container, then click the New Agent button (or use the Actions menu). Or you can right click on the Main-Container, and choose Start New Agent. This window pops up:

    Enter a name for the agent, say ping0. (In this window just use the nickname of the agent, that is, leave out the address. The address will be filled in by the system.)

    Then enter the fully qualified agent class name. In this case, examples.PingAgent.PingAgent. If your class paths are set correctly, after you click OK, the name ping0@IBM:1099/JADE will appear in the Main Container listing. (Of course, the host name will be yours, not mine :-).) If the class cannot be found, JADE will ignore your and may print an error on the Java Console (maybe).

    Loading Agents when booting JADE

    To carry out the same task as above you could have typed,

    runjade -gui ping0:examples.PingAgent.PingAgent

    and loaded the Ping Agent right away. Note the syntax with the agent nickname separated from its fully qualified class name by a colon.

    The Dummy Agent

    The Dummy agent has its own button on the RMA. Click it to bring up the DummyAgent window. The Window looks like this:

    A formidable form indeed. The form is set up to allow you to describe a Communicative (speech) Act.

    Fortunately, at this stage you don't need to know anything about SL. Nor do you have to fill in many fields. The fields you do need to deal with are, receivers, communicative act, and content.

    receivers. The receiver is the ping0 agent. With its pointer on the receivers box, right click the mouse and select "add". The AID (Agent ID) window appears.

    Fill in the form in the manner shown (using your own host name). In the case of the address right click the mouse on the text field.

    Note the check box. Checking it means the name is local (ping0) in this case. If you don't check it you need to enter the full agent name: ping0@IBM:1099/JADE.

    Back in the DummyAgent window, select QUERY-REF for the communicative act. In the request field, type in the word "ping". (See comment on the PingAgent.java source file.)

    Send a message

    Finally click the send the message by clicking the send button (second from left).

    In the right pane of the DummyAgent window two lines appear, one red, the other blue. The most recent is the topmost. Blue refers to sent messages, red to received messages. You have something like this:

    You can examine the received INFORM message (sent by the ping0@IBM:1099/JADE agent by selecting it and then clicking the button with the "glasses" icon.

    The ping agent has replied "alive". [In versions of JADE previous to version 2.5, the Ping Agent replies "(pong)".]

    Shutting Down the Platform

    In the RMA window, choose Shut down platform. Sometimes this does not work. In this case just type ctrl-c in the Java console window to shut down the JVM.