Java tutorial
//package com.java2s; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; public class Main { public static void setClipboardText(String str) { Clipboard clipBoard = Toolkit.getDefaultToolkit().getSystemClipboard(); StringSelection selection = new StringSelection(str); clipBoard.setContents(selection, null); } }