Can't copy to a clipboard from a background java application on MAC OSX
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.开发者_如何学C
Is there work around with this clipboard issue? This works on Windows and Linux, it seems to be a problem only on MAC.
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.
精彩评论