3

I am new to JADE environment and I am trying to run the agent via terminal and Eclipse on MAC OS. But it throws me below exception from both

Logs

$ java jade.Boot -container -agents MyAgent:examples.hello.HelloWorldAgent
Aug 18, 2016 10:24:15 PM jade.core.Runtime beginContainer
INFO: ----------------------------------
    This is JADE 4.4.0 - revision 6778 of 21-12-2015 12:24:43
    downloaded in Open Source, under LGPL restrictions,
    at http://jade.tilab.com/
----------------------------------------
Aug 18, 2016 10:24:15 PM jade.imtp.leap.LEAPIMTPManager initialize
INFO: Listening for intra-platform commands on address:
- jicp://

Aug 18, 2016 10:24:16 PM jade.core.BaseService init
INFO: Service jade.core.management.AgentManagement initialized
Aug 18, 2016 10:24:16 PM jade.core.BaseService init
INFO: Service jade.core.messaging.Messaging initialized
Aug 18, 2016 10:24:16 PM jade.core.BaseService init
INFO: Service jade.core.resource.ResourceManagement initialized
Aug 18, 2016 10:24:16 PM jade.core.BaseService init
INFO: Service jade.core.mobility.AgentMobility initialized
Aug 18, 2016 10:24:16 PM jade.core.BaseService init
INFO: Service jade.core.event.Notification initialized
Aug 18, 2016 10:24:16 PM jade.core.AgentContainerImpl startBootstrapAgents
SEVERE: Cannot create agent MyAgent: Class examples.hello.HelloWorldAgent for agent ( agent-identifier :name MyAgent@:1099/JADE ) not found - Caused by:  examples.hello.HelloWorldAgent
Aug 18, 2016 10:24:16 PM jade.core.AgentContainerImpl joinPlatform
INFO: --------------------------------------
Agent container Container-1@is ready.
--------------------------------------------

I have setup the JAVA_HOME in

/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home

I have JADE in $JAVA_HOME/lib and  /Library/Java/Extensions

On Eclipse I have given following arguments for another project by starting the main container on a separate terminal

-container -agents Test1:simple0.HelloAgent

I have spent hrs researching and trying to figure out what's going on but no luck with that. Any help would be much appreciated.

Cheers

Graduate
  • 119
  • 3
  • 8
  • you may need to add a classpath directive for java, so that jade can find your agent class file. That is `examples.hello.HelloWorldAgent.class` needs to be on the classpath at runtime – jr593 Aug 18 '16 at 13:24
  • Tried java -cp "jade.jar:jadeExamples.jar" jade.Boot -container -agents MyAgent:examples.hello.HelloWorldAgent but that didn't work :( – Graduate Aug 18 '16 at 13:40
  • hhmm.... Can you run the Agent from the JADE GUI ?. Also could you show the current directory name from where you run the command, and the directory name containing the agent...thanks – jr593 Aug 19 '16 at 13:57
  • @jr593 I can run JADE GUI successfully just saying `java jade.Boot -gui` on terminal then on another terminal instant I ran `$ cd /Users/xxx/Desktop/jade/lib` `$ java -cp "jade.jar:jadeExamples.jar" jade.Boot -container -agents MyAgent:examples.hello.HelloWorldAgent` as the jadeExamples.jar file is on that location – Graduate Aug 19 '16 at 23:12
  • FYI I tried running JADE GUI on the same location but it didn't make any difference :( – Graduate Aug 19 '16 at 23:20

1 Answers1

1

So after spending hrs and hrs I figured out what went wrong here. On MAC OS (Yosmite) Eclipse I had to add the project to the classpath. Then everything started to work.enter image description here

Graduate
  • 119
  • 3
  • 8
  • thanks a ton for this. For those of you running from the command line from the directory of the project, one way to add the project to the class path always is by adding `export CLASSPATH=$CLASSPATH:.` to the bash script. That way the current working directory is always included in the CLASSPATH. You can edit the bash script by the command `nano ~/.bashrc` on the terminal. – user0221441 Jul 09 '21 at 16:10