Java plugin system

Hi all.
I have made an irc bot in java and he's working fine.
But now I want to make a plugin system.
It's meant to organise the code and make it easier to add other functions.
I have absolutely no idea of how to start with it.
How can I do this?

Next, you need a system that allows you to load the plugins without recompiling. Here is a code frgament that demonstrates the idea. In this fragment, it is assumed a hot load is not necessary (i.e., must restart the program to pick up new plugins). If hot load is desired, you can use a custom ClassLoader to load them dynamically.

Java Code:

// obviously, you want to get the name of the plugin from a command line, environment variable, properties file, or whatever rather than hard coding like this
IRCPlugin plugin =
(IRCPlugin) Class.forName("IRCPluginA").newInstance();
plugin.doSomething();