Hello,
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/presence.java unreported exception org.jivesoftware.smack.XMPPException; must be caught or declared to be thrown
XMPPConnection connection = new XMPPConnection(“jabber.org”, 5222);
Where should I save my class? under …\smack\build directory?
please advise,
Angelica.
Angelica,
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.
Regards,
– Gato
Angelica,
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 :
http://java.sun.com/docs/books/tutorial/essential/exceptions/
In your case, just remember that whenever you call a method that might throw an exception, either :
Hope that helps
Regards,
Nic
Thanks a lot!
It was true… the error was related to Java code and not to Smack. It is fixed now
Greetings,
Angelica.