Can't copy to a clipboard from a background java application on MAC OSX

大兔子大兔子 提交于 2019-12-02 04:52:29

问题


We have 2 java applications running on MAC. One background application sends either a text or image to a clipboard, then the other application grabs that data and paste it in its application.

We have this problem when the app copies something on the clipboard, the background app won't be able to update the clipboard until it's UI becomes active.

Is there work around with this clipboard issue? This works on Windows and Linux, it seems to be a problem only on MAC.


回答1:


Don't.

What you are doing is generally referred to as "interprocess communication". There are various strategies to accomplish this. One of the more 'correct' approaches, in your cotext of two Java applications, would be to use Java RMI.

Doing it in a non-standard, "hackish" manner like you are with the clipboard is more problematic...as you have discovered the hard way.

Even if you did manage to get it running, the possibilities of problems in the future are high. E.g.: Imagine a Windows update changing the behavior of the clipboard--it would break your app on Windows.



来源:https://stackoverflow.com/questions/4402001/cant-copy-to-a-clipboard-from-a-background-java-application-on-mac-osx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!