powered by Jive Software

Cannot find symbol (class message)


I’'m getting this error while compiling my source:

javac -cp “smack.jar:smackx.jar:” message.java

message.java:12: cannot find symbol

symbol : class Message

location: class message

Message message = chat.createMessage();


1 error

This is the source code:

import org.jivesoftware.smack.*;

public class message


public static void main(String[] args)




XMPPConnection con = new XMPPConnection(“dettlx10.tt.de.ifm”);

XMPPConnection.DEBUG_ENABLED = true;

con.login(“test”, “test”);

  Chat chat = con.createChat("test2@dettlx10.tt.de.ifm");

Message message = chat.createMessage();

message.setBody(“this is a test-message”);



catch (Exception e)







What’'s my mistake?



Hey Frank,

Which IDE are you using? Your IDE should be able to detect this kind of problems.

You need to add a new import statement like this:

import org.jivesoftware.smack.packet.*;

I’‘d recommend changing the name of your class to something different than message (maybe confused with Smack’'s Message) and it should also start with an uppercase letter.


– Gato

Hi Gaston,

my IDE is the command line I don’'t have a IDE yet, can you prefer a good (=simple) one for me on Linux?

The import statement did the trick, but I don’'t know why I thought import org.jivesoftware.smack.* would import everything (because of the *) but it seems that I was wrong.

Where can I get a list of import statements and how do I know which one I need for the different methods in my source?

Thanks for you help,


NetBeans is a good (free & free) IDE, though heavyweight - http://www.netbeans.org

Personally I’‘m using Scite ( http://www.scintilla.org/SciTE.html ) , which is a good text editor and works well if you’'re into handcoding Java.

Regarding the import statements,

import org.jivesoftware.smack.*;

imports all the classes of the org.jivesoftware.smack package - it won’'t include any “child” packages such as org.jivesoftware.smack.packet.

To know which package(s) you need to import for a paricular class, in the Javadoc that comes with smack, look at the top of the page - it will say which package the class is part of.

HTH, Pheet

Hi Pheet,

NetBeans looks nice, thanks for that hint!

BTW: How do you create highlighted text in this forum?