java进程间通信
是否可以使用在命令行中运行java类来运行正在运行的swing中的某个类或函数?
例如,当java Test asd
将setText一个正在运行的swing Jlabel到asd时
is it possible to use run a java class in command line to run a certain class or function in a running swing?
such as , when java Test asd
will setText a running swing Jlabel to asd
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这两个程序在不同的进程中运行。您需要在进程之间创建一个接口(或者正如 Matthew 所说:实现
进程间通信
)。有数百万种方法可以实现此目的,仅举几例:The two programs run in separate processes. You will need to create an interface between the processes (or as Matthew put it: implement
inter-process communication
). There are millions of ways to achieve this, just to name a few:最直接的方法是创建 RMI 方法调用。
它从一开始就内置于 java 中,相当简单且轻量级。
The most straight forward way is to create an RMI method call.
It's built into java from the beginning, reasonably simple and lightweight.