java进程间通信

发布于 2024-10-10 02:06:31 字数 118 浏览 0 评论 0原文

是否可以使用在命令行中运行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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

路弥 2024-10-17 02:06:31

这两个程序在不同的进程中运行。您需要在进程之间创建一个接口(或者正如 Matthew 所说:实现进程间通信)。有数百万种方法可以实现此目的,仅举几例:

  • 创建基于文件的接口(Test 将写入文件,JLabel 将读取该文件)
  • 在两者之间创建 TCP/IP 连接
  • 在两者之间创建 HTTP 连接两个(JLabel 可能运行 glassfish 线程或类似的东西)
  • 创建 JMS 连接
  • 创建 RMI 方法调用
  • 创建 Web 服务(同样使用运行 glassfish 的 JLabel)
  • 更多...

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:

  • Create a file-based interface (Test will write into a file and JLabel will read that file)
  • Create a TCP/IP connection between the two
  • Create a HTTP connection between the two (JLabel may run a glassfish thread or something like that)
  • Create a JMS connection
  • Create an RMI method call
  • Create a Webservice (again with JLabel running glassfish)
  • Many more...
困倦 2024-10-17 02:06:31

最直接的方法是创建 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文