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.

Regards,

Matt

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:

org/jivesoftware/smack/MainTest)

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

at java.lang.ClassLoader.defineClass(ClassLoader.java:537)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12

at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)

at java.net.URLClassLoader.access$100(URLClassLoader.java:55)

at java.net.URLClassLoader$1.run(URLClassLoader.java:194)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:187)

at java.lang.ClassLoader.loadClass(ClassLoader.java:289)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)

at java.lang.ClassLoader.loadClass(ClassLoader.java:235)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

Thanks for the fast reply

Remove the package statement at the top of your class.