New to SMACK- Need Help!

Hi All,

I am new to SMACK and Jabber community. I have a Jabber Server set up on my “Linux box” with “jabberserver” as its name.The code below simply tries to connect to server as that user.The users account has already been created at the server.The code gets compiled and its placed in the correct directory structure. My question is what is the next step, do i need to run this program from Classes directory as “java MainTest” or what should i do to see my “client code” communicate with “server”.

– code begin—

package org.jivesoftware.smack;

import org.jivesoftware.smack.*;

public class MainTest {

public static void main(String [] args) throws Exception {

XMPPConnection.DEBUG_ENABLED = true;

XMPPConnection con = new XMPPConnection(“jabberserver”);

con.login(“abc”, “pwd”);



– code end—

I’‘m not quire sure what you’‘re trying to accomplish. The program you wrote looks like it should work fine, but it doesn’'t do much.



yes i understand that the program doesnt do much. i am looking for code which talks to jabberserver. i get the following errors:

Exception in thread “main” java.lang.NoClassDefFoundError: MainTest (wrong name:


at java.lang.ClassLoader.defineClass0(Native Method)

at java.lang.ClassLoader.defineClass(





at Method)


at java.lang.ClassLoader.loadClass(

at sun.misc.Launcher$AppClassLoader.loadClass(

at java.lang.ClassLoader.loadClass(

at java.lang.ClassLoader.loadClassInternal(

Thanks for the fast reply

Remove the package statement at the top of your class.