Running the first
mobile agent
This is short description what should be done to
successfully run the first mobile agent under Windows NT 4.0 with MS Visual J++
installed.
- Install Concordia (in this exapmle it is run on the
localhost but could be on any machine)
- Install JDK 1.1.6+ ( :( )
- Run the Concordia Server (in this exapmle it is run
on localhost but could be on any machine)
- Run MS Visual J++
- Create the new project - console application
- Define the project specific classpath:
- Click the Project in the menu
- Choose Project Properties (should be the last
ithem)
- Choose Classpath tab
- In Project Specific click on button New..
- Type the full path to files that could be found
in Concordia Server Control Panel / Configure button
(e.g. E:\Program Files\Mitsubishi
Electric\Concordia\Agents\lib\Concordia.jar
and
E:\Program Files\Mitsubishi Electric\Concordia\lib\3rdpty.jar)
- Define external program to run your
programs
This is neccessery if you want to launch agents from your code
(See Lesson 2)
- Click the Project in the menu
- Choose Project Properties (should be the last
ithem)
- Choose the Launch tab
- Chech Custom
- In Program box type full path to Sun's Java
(e.g. E:\JEZICI\jdk1.1.7A\bin\java.exe)
- In Argument box type -classpath
"<JAVAPACKAGES>" Project1.Class1
(Project1 is the name of your package and Class1
is the class to execute)
- Add method to created class that will be run on
remote server (see example
for steps 6, 7, 8.)
- Import COM.meitca.concordia.*;
- New Class extends Agent
- Build
- Start Concordia Agent Lunch Wizard
- Enter full path to created class
(e.g.
F:\Users\Dejan\Programiranje\Project1\Class1.class) and click the Next
button.
- Click Next..
- Click Insert to add server name and method
- Add server name or IP of Concordia server - replace
New Destination (e.g. localhost)
- Add method that will be executed on th server -
replace New Method (e.g. pisi())
- Click Finish
- Server should execute the method or report errors
Example. Text in red is added to file created by
wizard
/**
* This class can take a variable number of parameters on the command
* line. Program execution begins with the main() method.
The class
* constructor is not invoked unless an object
of type 'Class1'
* created in the main() method.
*/
import COM.meitca.concordia.*;
public class
Class1 extends Agent
{
/** * The main entry point for the application.
*
* @param args Array of parameters passed to the application
* via the command line.
*/
public static void
main (String[] args) {
// TODO: Add initialization code here
}
public void pisi() {
// TODO: Add initialization
code here
System.out.println("Dejan was here!\n");
}
}