I have a class and I have a method inside this class.

Method:

```
public void login(String username,String password) throws XMPPException, SmackException, IOException {
    ConnectionConfiguration configuration=new ConnectionConfiguration("", 5222,"localhost");
    configuration.setSecurityMode(SecurityMode.disabled);
    connection=new XMPPTCPConnection(configuration);
    try {
        connection.connect();
        connection.login(username,password);
        ChatManager chatmanager = ChatManager.getInstanceFor(connection);
        chatmanager.addChatListener(new ChatManagerListener() {
            public void chatCreated(final Chat chat, final boolean createdLocally) {
                chat.addMessageListener(messageListener);
            }
        });
    }                       
    catch (XMPPException | SmackException | IOException e) {
        e.printStackTrace();
    }
}

```

Xmpp requires try/catch block.I defined try/catch inside method.But when I try to use this method in main class I am getting compiler error :

```
Unhandled exception type IOException

```

I am using like this:

```
SmackClass smack=new SmackClass();
smack.login("asdad","asdasd");

```

How can I resolve this problem ?