tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > Jodd > Clip Board > How to copy a string to Clipboard in java

How to copy a string to Clipboard in java 

Jodd is an open-source java library with lot of reusable components and feature rich utilities. This requires the library jodd-3.3.2.jar to be in classpath. The following example shows how to use ClipboardUtil.copyToClipboard() API. It copies the given string to system clipboard.

File Name  :  
com/bethecoder/tutorials/jodd/clipboard/CopyToClipboardTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.jodd.clipboard;

import jodd.util.ClipboardUtil;

public class CopyToClipboardTest {

  /**
   @param args
   */
  public static void main(String[] args) {
    String str = "Tutorials from BE THE CODER";
    ClipboardUtil.copyToClipboard(str)
    //Now you can paste the copied text to notepad or any other editor. 
  }

}
   

It gives the following output,
Tutorials from BE THE CODER



 
  


  
bl  br