Wednesday, February 4, 2009

Setting up JADE in Netbeans

Well today a very geeky post and irrelevant for most of you, but I didn't find a quick fully description for this online, and it was a while since the last time I set this up. So as you would expect you tend to forget some steps, so here goes mine minus the use of google :P.

1. Have Netbeans installed, I think that is pretty straightforward so I am skipping the details.

2. Download JADE, just the minimum if you want, but I recommend all of the packages because if you are going to use JADE you will probably end up using them.

3. Extract the files into a folder, if you have all of the packages I suggest different folders.

4. Run Netbeans, create a project, etc. Again this is quite straightforward and if you are using JADE in Netbeans you should have basic knowledge of the tool.

5. Right click on Libraries, Add Library.

6. Create Library.

7. I would suggest the name to be JADE

8. Add the .jar files contained in the "bin" folder that you created (In the minimum JADE package you only have this folder), the files should be the folder you created + "/jade/lib/".

9. Right click on your project, Set Configuration, Customize...

10. Write on the main class "jade.Boot", and on arguments "-gui".

Now if you run the program it will launch the GUI that allows you to run agents.
Hope this is clear I could have used some screen shots, but I think this is quite straightforward, or at least I hope. In the unlikely event of a blog reader using these steps and have some questions, please fell free to leave a comment, and I'll get back to you.

44 comments:

MastereICIS said...

thanks! it's very helpful for me.
'Cause i begin multi agent developpement with JADE using netbeans.

can I contact you, if I need a help with JADE?

MastereICIS said...

In netbean 6.5, I set my project configuration, for run option as:

main class: jade.Boot
arguments: -gui Hey:jadeexample01.AgentHello

when I run my project, Its doesnt work normally or does not react anything of compiler as I run while I usually work in Netbean 6.1.

Why????

Any one can help me?
Thank a lot

Pedro Ferreira said...

Hi, good to know it is helpful. I've been moving that is why I took so long to reply otherwise I would have quicker. Does the compiler run just the GUI?

anon said...

Thanks a lot.. I followed your instructions. But when i try to run it, I'm getting a comment that jade.Boot class doesnt exist and the project doesnt run. Please help me with this.

Pedro Ferreira said...

I would expect you have a problem with the library, if the that is OK it should run fine.

Hesham said...

Thanks man, that was really helpful

Rania Fahim said...

Thank you Pedro Your steps really helped me and finally the JADE worked on NetBeans.

One more request: Do you know how to set up the JADE LEAP on the NetBeans? I have Java ME platform installed in the NetBeans.

Pedro Ferreira said...

Hi rose, sorry never worked with LEAP, but for mobile devices there is a lot of help online if you use eclipse instead of netbeans

Rania Fahim said...

Thank you Pedro

jayanti said...

i get an error while running jade program, stating tat the class does not have main method. Can u plz help me?

Pedro Ferreira said...

Hi jayanti, I suspect you are not following the 10 step, or the path is not clear, i suggest you re follow the steps if it doesn't work let me know :D

Anonymous said...

could you please tell me how to edit protege 4.1 in Net beans

Pedro Ferreira said...

What do you mean by edit? You have the libraries in place? Then it is just open file where you have your protege model, and you should have your model in a object in netbeans.

Anonymous said...

I need to create my project using protege editor, for that i should have to put that into Net beans, how i do that?

Pedro Ferreira said...

If you already have a project created in the editor, after you have the libraries of protege in netbeans, you can simply open the project something like :

KnowledgeBase knowledgeBase = null;

Collection errors = new ArrayList();
Project protegePoject = new Project("/path/filename.pprj", errors);
if (errors.size() == 0) {
knowledgeBase = protegePoject.getKnowledgeBase();
...;
} else {
...;
}

Rania Fahim said...

hi I'm developing java program to send SMS message to mobile is there an efficient solution or code for that?

Thank you

Pedro Ferreira said...

Sorry rose, never worked with sms, I expect if you have a sms server for interfacing it should be too complicated. sms have a clear package structure, so it should be just constructing it and sending to server.

Rania Fahim said...

Thank you Pedro

Rania Fahim said...

Hello Pedro
Did you try to pass parameters from JSP page to a JADE agent using JADE Gateway?

Pedro Ferreira said...

Hi Rose, sorry but I haven't, however I should see it as a big problem, can you be more specific on the problem? I would think it has something to do with the configurations this might contain the info you need, at the moment I don't have access to my code, however if you have more concrete issue let me know.

http://jade.tilab.com/doc/tutorials/JADEAdmin/HttpMtpTutorial.html

Rania Fahim said...

I use JSP page containing form to fill some entries for an event, this form posts the entries to a servlet class. These entries are put into serializable object:

public class MyEvent implements Serializable{

/**
* @param args
*/

private String cat = "";
private String title = "";
private String description = "";

public MyEvent(){

}

public void setCat(String c){
this.cat = c;
}

public void setTitle(String t){
this.title = t;
}

public void setDesc(String d){
this.description = d;
}

public String getCat(){
return cat;
}

public String getTitle(){
return title;
}

public String getDescription(){
return description;
}

public void getEvent(){
System.out.println("Event Category: "+cat+" Event Title: "+title+"\n"+"Event Details: "+description);
}
}

I suppose to send this object in ACL message to an agent:

public class EventAgent extends Agent{
MyEvent ev;

protected void setup(){
try{
ACLMessage msg = blockingReceive();
System.out.println(getLocalName()+" Event is: "+msg);
ev = (MyEvent) msg.getContentObject();
System.out.println(getLocalName()+" New Event "+"\n"+"Event Category: "+ev.getCat()+"\n"+"Event Title: "+ev.getTitle()+"\n"+"Event Details: "+ev.getDescription());
}
catch(UnreadableException ue){
ue.getMessage();
}
}

protected void takeDown() {
System.out.println("Event Agent "+getAID().getName()+"terminating.");
}
}

Pedro Ferreira said...

If understood correctly you are setting up the agent to get the message, however I expect that the problem is not on the code, if you test it with another agent doesn't it work? The problem should be on the communication outside of the JADE platform. This link should help http://jade.tilab.com/doc/tutorials/JADEAdmin/HttpMtpTutorial.html, another think I suggest is setting up two JADE platforms (On different computers if possible) and get them to communicate, you will see a lot of the configuration issues that will hopefully lead you to solve the problem. Hope this helps...

Rania Fahim said...

I will try what you said Pedro, Thank you so much.

Anonymous said...

Hi.. Have to do a project using protege.. how to access protege using netbeans.. where to get protege libraries..pls guide me..

Pedro Ferreira said...

Hi, well for the libraries just install protege and check in the folder for the ".jar" files. Add these to the library in your project and you should be fine. Using them is a bit trickier but you will see :)

Anonymous said...

Thanks Pedro!! Got it... My project is to retrieve information from ontology when we query it..If it s possible can u guide me?? If not, can anyone suggest me any other project which involves protege and ontology and also easy to do..

Anonymous said...

Thanks Pedro!! Got it... My project is to retrieve information from ontology when we query it..If it s possible can u guide me?? If not, can anyone suggest me any other project which involves protege and ontology and also easy to do..

Anonymous said...

. It was really helpful. Thanx alot

Anonymous said...

Is it possible to change the Ip address with Java program? If so can anyone help me with the code..

Madhusha Nanayakkara said...

-gui agentName:example.Agent

If you are looking forward to start an agent automatically at start up, make sure you specify a nickname for the each agent.

NG said...

Pedro your the man thanks for making life easy for agent newbies :)

Anonymous said...

Brilliant! Thanks :) :)

Bals said...

hi frnd pedro im dng project in mobile agent migration,do u know about agent migration...

Pedro Ferreira said...

Hi Bals,

Well migration of agents yes, that is to deploy agents in other platforms. JADE allows for this quite easily, you just have to have the platform running and its adress.

Anyway not sure of your question so....

Anonymous said...

hi.
well i am new to JADE and i want to know the step to start a new agent. What should be done to run the coding? please help me.

Pedro Ferreira said...

if you follow these steps you should be able to run a set of example agents, that is my recomendation for you to start looking at code

Unknown said...

hello!!! i want to integrate both jade and weka in Netbeans and also want to create such agent that could pass a file from one machine to another...
PLEASE HELP ME REGARDING THIS!!!!

jackal said...

Hi Meha,

Passing a file between agent is quite straighfoward. You can simply read the file into a serializable buffer and pass it as an object in a message. An them convert it back to a file on the other side. As for the Weka, I am not familiar with it, however from a brief look at their website, it should be as easy as adding the .jar files, so the libraries.

Hope this helps

shahnaz said...

thank you
it's really helpful

Anonymous said...

Thanks a lot, I find out your instructions the most helpful in the internet. However, my Netbeans insist on giving me the alert "No main class is found". So it is right also, because my netbeans project has only JADE library, but no main class. Where do I do a mistake?

Anonymous said...

Same steps with screenshots:

http://qh.eng.ua.edu/classes/fall2012/ece693/index_files/ECE693_Mobile_Programming_ECE_Lecture20.pdf

Unknown said...

hi, i want to creat multplie agent system with JADE & Netbeans.
and i set the main class: jade.Boot
and the argument to -gui Agent1: jade.jade
the name of my class and my package is jade.
but in the platform, i cant see Agent1.
what's worng with that?
thanks.

Unknown said...
This comment has been removed by the author.
Unknown said...

hi, i want to creat multplie agent system with JADE & Netbeans.
and i set the main class: jade.Boot
and the argument to -gui Agent1: jade.jade
the name of my class and my package is jade.
but in the platform, i cant see Agent1.
what's worng with that?
thanks.