Question: I have created a package:

**path** : /home/myid/py\_ejb  

**File** : XmppMnager.java

```
package xmpp;

import org.jivesoftware.smack.Chat;
public class XmppManager {
}

```

Compiled with

```
javac -d . -classpath .:smack.jar XmppManager.java

```

**File**: XmppTest.java

```
import xmpp.*;

public class XmppTest {

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

        String username = "testuser1";
        String password = "testuser1pass";

        XmppManager xmppManager = new XmppManager("myserver", 5222);

..}

```

Compiled with

```
$ javac  -classpath .:smack.jar:./xmpp XmppTest.java 
XmppTest.java:10: cannot access XmppManager
bad class file: RegularFileObject[./xmpp/XmppManager.class]
class file contains wrong class: xmpp.XmppManager
Please remove or make sure it appears in the correct subdirectory of the classpath.
        XmppManager xmppManager = new XmppManager("myserver", 5222);
        ^
1 error

```

I tried a lot of way to fix this compilation issue but it just does not go away

Answer: 
Move the source files into a folder named `xmpp` so that the package names match that of the folder
Package names are directly related to the classpath directory structure. All the classes in the `xmpp` package need to be in a folder named `xmpp`, and this folder must be on the classpath. Similarly, if you had a package called `xmpp.util.io` you would have to put the files in `xmpp/util/io/`.

The usual convention is to make a `src` directory to hold all your source files, and then that can be filled with a directory structure that exactly matches your package structure. A pretty decent tutorial on packages can be found [here](http://tinf2.vub.ac.be/~dvermeir/java/other_doc/JavaPackages.html).

---

Also, it looks like this is probably just a typo in the question, but if your file is actually named `XmppMnager.java` rather than `XmppManager.java`, that won't compile either.