Point here is CPU is too fast so that is why you
1) put p.waitfor() to wait the process finish running
2) Put thread.sleep(5000) to wait for the Ctrl+C to put the copied contents to clipboard.
Note: Honestly 5000 is too long 200 will do the trick but I didn't modify the code because I'm lazy.
本文介绍了一个Java程序示例,演示了如何使用Java AWT包中的类进行剪贴板操作,包括设置剪贴板内容及获取剪贴板中的文本。
3万+

被折叠的 条评论
为什么被折叠?



