I have a Java application that has a line of code that says:
String myString="Some Text";
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(myString, null);
And this works great when I run my application in Eclipse with Java 5. When I create a .ear file and deploy it on websphere i get an exception that looks like this:
Caused by: java.awt.HeadlessException
at sun.awt.HeadlessToolkit.getSystemClipboard(HeadlessToolkit.java:306)
at something.something.something.package$MyButtonListener.buttonClick(View.java:271)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:512)
I can't seem to solve this, does anyone have any ideas? I understand that it is trying to set the clipboard on the server but how do I set it on the user of the webapplications computer?