powered by Jive Software

presenceChanged problem


i’'m getting the following exception when i compile the code.

C:\smack\classes>javac Jabber.java

Jabber.java:37: main.Jabber should be declared abstract; it does not define presenceChanged(java.lang.String) in main.Jabber

my program starts like this

public class Jabber extends JFrame implements PacketListener, ActionListener,RosterListener, JAB {


i’'ve imported all the packages

import org.jivesoftware.smack.*;

import org.jivesoftware.smack.filter.*;

import org.jivesoftware.smack.packet.*;

import org.jivesoftware.smack.util.*;

it pin points to RosterListener.how do i debug this problem ???


In order to implement the RosterListener interface, you must implement a presenceChanged method in your class. I think the compiler error makes this pretty clear.



Thanks Matt.I fixed it.

I’‘ve written all the required files to create a jabber client using smack API.it is compiling properly but when i’'m executing it i get many exceptions.

C:\smack\classes>java -cp C:\smack\smack.jar;C:\smack\smackx.jar; Jabber

Exception in thread “main” java.lang.NoClassDefFoundError: Jabber (wrong nam

e: main/Jabber)

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

at java.lang.ClassLoader.defineClass(Unknown Source)

at java.security.SecureClassLoader.defineClass(Unknown Source)

at java.net.URLClassLoader.defineClass(Unknown Source)

at java.net.URLClassLoader.access$100(Unknown Source)

at java.net.URLClassLoader$1.run(Unknown Source)

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

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClassInternal(Unknown Source)

one thing i dont understand is the first line

Exception in thread “main” java.lang.NoClassDefFoundError: Jabber (wrong name: main/Jabber)

what does wrong name here mean ???

if i fix this error i’'m done guyzzz.

i cant post all my code here as it wouldnt make any sense and very difficult understand.any suggestions ???



Please check the class name that you are giving on the command line:

C:\smack\classes>java -cp C:\smack\smack.jar;C:\smack\smackx.jar; Jabber

Are you sure that you class name is Jabber and if so please check the case of the class name i.e. Jabber or jabber.


hi rajesh

i’‘m giving the correct class path.infact i’'m running many programs using the class path.and my program name given at compilation and execution is same as the program name.

if at all i was giving a wrong class name i wouldnt have compiled it right.

anyways i need suggestions guyzzz ??? i’'m running out of time.

i can mail my code if any one of you are interested in looking into it.



Just copy the following line and paste it into your command window and try, i have just replaced the Jabber with jabber !

C:\smack\classes>java -cp C:\smack\smack.jar;C:\smack\smackx.jar; jabber

If this does not work, please mail me your code at kcrmails[at]yahoo.com. Replace the with @.