I'm wondering if I can access to a Posix Message Queue in Java as I have an application that can't be modified and uses a message queue to talk to other processes. Is there any api or package that do that? I know that I can use JNI but I need to do this ASAP so no time to develop that.
我想知道我是否可以訪問Java中的Posix消息隊列,因為我有一個無法修改的應用程序,並使用消息隊列與其他進程通信。有沒有api或包這樣做?我知道我可以使用JNI,但我需要盡快這樣做,所以沒時間開發它。
Regards.
2 个解决方案
#1
5
A bit of Googling found Posix for Java.
一些谷歌搜索找到了Posix for Java。
#2
3
Take a look at JNA at GitHub (latest JavaDoc). Quoting the project's description:
在GitHub上看看JNA(最新的JavaDoc)。引用項目的描述:
JNA provides Java programs easy access to native shared libraries (DLLs on Windows) without writing anything but Java code—no JNI or native code is required. This functionality is comparable to Windows' Platform/Invoke and Python's ctypes. Access is dynamic at runtime without code generation.
JNA為Java程序提供了對本機共享庫(Windows上的DLL)的輕松訪問,而無需編寫除Java代碼之外的任何內容 - 不需要JNI或本機代碼。此功能可與Windows的Platform / Invoke和Python的ctypes相媲美。訪問在運行時是動態的,無需生成代碼。
Several projects are using it, including IntelliJ IDEA, Cassandra, and Netbeans.
有幾個項目正在使用它,包括IntelliJ IDEA,Cassandra和Netbeans。