powered by Jive Software

Problems using smack from jar''d app

This problem has been driving me crazy all week. I’‘ve got a little bot program that uses Smack, and everything works great when it’‘s not jarred. When I run it from the .jar, it complains that it can’'t find org.jivesoftware.smack.XMPPException, even though the classpath and everything else is the same.

To work around that, I tried un-jarring the smack jars and including them directly in my jar. In this case everything works except message events (delivered/displayed notifications). The spark debugger shows they’‘re still being sent, but the smack code apparently just ignores them because there aren’‘t any error messages. I’'ve tried deleting all the class files and rebuilding from scratch numerous times to make sure that my jar had the same code as my class files.

If anyone has the slightest clue what could be going on here, I’'d really appreciate it.

There really should be faq that covers this or sticky thread…

When you make an executable jar the classpath will not be the same because executable jars ignore the classpath. You can do one of the following to make it work:

  • Make a mainfest file the configures the classpath

  • Put the smack jars in your lib/ext directory of your JDK/JRE

  • Have your application be a library jar instead of a executable jar

For more info start with this thread http://www.igniterealtime.org/forum/thread.jspa?threadID=26945