无法从MAC OSX上的后台Java应用程序复制到剪贴板 [英] Can't copy to a clipboard from a background java application on MAC OSX

查看:199
本文介绍了无法从MAC OSX上的后台Java应用程序复制到剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在MAC上运行了2个java应用程序。一个后台应用程序将文本或图像发送到剪贴板,然后另一个应用程序抓取该数据并将其粘贴到其应用程序中。

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.

我们在应用程序副本时遇到此问题在剪贴板上的某些东西,后台应用程序将无法更新剪贴板,直到它的UI变为活动状态。

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.

是否有解决此剪贴板问题的方法?这适用于Windows和Linux,它似乎只是MAC上的问题。

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

推荐答案

不要。



您正在做的事情通常被称为 进程间通信 。有各种策略可以实现这一目标。在两个Java应用程序的cotext中,更正确的方法之一是使用 Java RMI

像你使用剪贴板一样以非标准的hackish方式进行操作更有问题......正如你所发现的那样困难的方式。

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

即使您确实设法让它运行,未来出现问题的可能性也很高。例如:想象一下Windows更新改变了剪贴板的行为 - 它会破坏你在Windows上的应用程序。

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.

这篇关于无法从MAC OSX上的后台Java应用程序复制到剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆