在Java中实现COM接口

在Java中实现COM接口

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

问题描述

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

How can I implement a vtable COM interface in java?

在过去,我将使用Microsft JVM,它内置了java-COM互操作。

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?

对类似的建议JACOB。我看过JACOB,但是这是基于IDispatch,并且旨在控制自动化承包商。我需要的COM接口是自定义vtable(扩展IUnknown),例如。 IPesistStream,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 may be what you need. From the homepage:

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

08-20 03:29