The following static method copies the data it gets into the system clipboard:

 // This method writes a string to the system clipboard.
public static void copyToSystemClipboard(String str) {
    StringSelection ss = new StringSelection(str);
    Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
}