title: Clipboard copy between server and client in Java
body: <p>I try to create a button that copy in the clipboard a String and then user can paste it.</p>
  
  <p>I can do it when I do my test in local, but when I deploy the application on a server, nothing is saved in clipboard after an user click on button.</p>
  
  <p>Here's my code :</p>
  
  <pre><code>public void clipboard() {
          try {
              StringSelection stringSelection = new StringSelection("test");
              Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
              clpbrd.setContents(stringSelection, null);
          } catch (Throwable e) {
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>How can I do it ?</p>