Smack installation


I am new with Smack, and need help!! I want to setup a very simple client that communicates with a jabber server. I’'ve installed smack, set the JAVA_HOME system variable and seems to work, but at the time I try to execute my program I get the following error:

presence/ unreported exception org.jivesoftware.smack.XMPPException; must be caught or declared to be thrown

XMPPConnection connection = new XMPPConnection(“”, 5222);

Where should I save my class? under …\smack\build directory?

please advise,



From the error that you are receiving the problem seems to be a Java error and not an installation problem. In your code, when you create an XMPPConnection you should either enclose it between a try/catch block so that your catch section can catch XMPPExceptions or you should add a “throws XMPPException” clause to the method that is creating a connection.


– Gato


It seems you’'re not too familiar with exceptions (I understand, who wants to care about error-handling ? Yurk ! ), I suggest you check out this link for a start :

In your case, just remember that whenever you call a method that might throw an exception, either :

  • enclose the call into a try/catch block

  • declare the calling method to be throwing the exception.

Hope that helps



Thanks a lot!

It was true… the error was related to Java code and not to Smack. It is fixed now