java-COM interop:用Java实现COM接口

java-COM interop: Implement COM interface in Java(java-COM interop:用Java实现COM接口)
本文介绍了java-COM interop:用Java实现COM接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

限时送ChatGPT账号..

如何在 java 中实现 vtable COM 接口?

How can I implement a vtable COM interface in java?

在过去,我会使用 Microsft JVM,它内置了 java-COM 互操作.现代 JRE 的等价物是什么?

In the old days, I'd use the Microsft JVM, which had built in java-COM interop. What's the equivalent for a modern JRE?

回答一个类似的SO问题雅各布.我看过 JACOB,但它基于 IDispatch,旨在控制自动化服务器.我需要的 COM 接口是自定义 vtable(扩展 IUnknown),例如IPersistStream、IOleWindow、IContextMenu 等

Answers to a similar SO question proposed JACOB. I've looked at JACOB, but that is based on IDispatch, and is aimed at controlling Automation serers. The COM interfaces I need are custom vtable (extend IUnknown), e.g. IPersistStream, IOleWindow, IContextMenu etc.

对于我的用例,我可以在 JNI 中实现所有 COM 细节,并让 JNI 层调用 java 中的相应接口.但我希望有一个不那么痛苦的解决方案.

For my use case, I could implement all the COM specifics in JNI, and have the JNI layer call corresponding interfaces in java. But I'm hoping for a less painful solution.

这是一个开源项目,所以首选开源替代品.

It's for an open source project, so open source alternatives are preferred.

Com4j 看起来很有希望.查看可用的文档,它似乎不支持注册 IClassFactory,因此 COM 对象(在 java 中)可以由非 java 客户端实例化.

Com4j looks promising. Looking through the available docs, it doesn't seem to support registering a IClassFactory so the COM object (in java) can be instantiated by non-java clients.

推荐答案

Com4J可能是你需要的.从主页:

Com4J may be what you need. From the homepage:

直接绑定到 vtable 接口(不是 IDispatch)用于改进性能和更广泛的支持更多 COM 接口.

Binds directly to the vtable interface (not IDispatch) for improved performance and broader support for more COM interfaces.

这篇关于java-COM interop:用Java实现COM接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Sending a keyboard event from java to any application (on-screen-keyboard)(将键盘事件从 java 发送到任何应用程序(屏幕键盘))
How to make JComboBox selected item not changed when scrolling through its popuplist using keyboard(使用键盘滚动其弹出列表时如何使 JComboBox 所选项目不更改)
Capturing keystrokes without focus(在没有焦点的情况下捕获击键)
How can I position a layout right above the android on-screen keyboard?(如何将布局放置在 android 屏幕键盘的正上方?)
How to check for key being held down on startup in Java(如何检查在Java中启动时按住的键)
Android - Get keyboard key press(Android - 获取键盘按键)