-
Bug
-
Resolution: Unresolved
-
P4
-
8, 9
-
x86_64
-
linux
FULL PRODUCT VERSION :
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux limac 4.10.11-200.fc25.x86_64 #1 SMP Tue Apr 18 17:25:01 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The Clipboard.setContents should put some contents in the system clipboard, and this function works great in Windows and Mac OS. But on linux, this does not work.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. compile the attached source code in Windows, Mac OS, and in Linux.
(javac -d cls Test.java)
2. run this test program.
(java -cp cls test.Test)
3. paste in any application that accept text input. In both Windows and Mac OS, I get "copy and paste", but in Linux, I get nothing.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expect the paste action to produce "copy and paste" text.
ACTUAL -
I got nothing.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error message. The clipboard is just empty.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
import java.awt.*;
import java.awt.datatransfer.*;
public class Test {
public static void main(String[] args) {
StringSelection ss = new StringSelection("copy and paste");
Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
cb.setContents(ss, null);
}
}
---------- END SOURCE ----------
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux limac 4.10.11-200.fc25.x86_64 #1 SMP Tue Apr 18 17:25:01 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The Clipboard.setContents should put some contents in the system clipboard, and this function works great in Windows and Mac OS. But on linux, this does not work.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. compile the attached source code in Windows, Mac OS, and in Linux.
(javac -d cls Test.java)
2. run this test program.
(java -cp cls test.Test)
3. paste in any application that accept text input. In both Windows and Mac OS, I get "copy and paste", but in Linux, I get nothing.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expect the paste action to produce "copy and paste" text.
ACTUAL -
I got nothing.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error message. The clipboard is just empty.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
import java.awt.*;
import java.awt.datatransfer.*;
public class Test {
public static void main(String[] args) {
StringSelection ss = new StringSelection("copy and paste");
Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
cb.setContents(ss, null);
}
}
---------- END SOURCE ----------