简体   繁体   English

如何通过COM调用Java方法

[英]How to invoke Java methods through COM

I have a classic ASP/VBScript application that needs to call methods in a Java class. 我有一个经典的ASP / VBScript应用程序,需要在Java类中调用方法。 I discovered two products that apparently can do this: Java2COM and Java COM Bridge . 我发现了两个显然可以做到这一点的产品: Java2COMJava COM Bridge Can you recommend one from experience, or is there yet another mechanism by which we can do this which is better? 您可以从经验中推荐一个,还是可以通过另一种更好的机制来做到这一点? I'd rather avoid having to write C++ code if possible, although we could certainly create a COM DLL in VB6 that could in turn call low level APIs as necessary. 我宁愿避免尽可能地编写C ++代码,尽管我们当然可以在VB6中创建一个COM DLL,然后可以根据需要调用低级API。

To do this you basically need to have a COM Server that then uses JNI to create a JVM and make Java calls. 为此,您基本上需要拥有一个COM服务器,然后使用JNI创建JVM并进行Java调用。 It is a bit tricky and examples are scarce, which may make the products you have listed helpful. 这有点棘手,例子很少,这可能会使您列出的产品有所帮助。 I can't vouch for either of them. 我不能保证他们中的任何一个。

Alternatively, you may want to consider a web service based approach and get to the Java classes that way, depending on what they are and how you're using them. 另外,您可能希望考虑基于Web服务的方法,并以这种方式访问​​Java类,具体取决于它们是什么以及如何使用它们。

Agree with Bert. 同意伯特。 You could try jpype or jni4net for the jni part. 您可以在jni部分尝试jpypejni4net
Making a com server with pywin32 in python is a cake thanks to mark hammond . 感谢mark hammond ,用python中的pywin32制作一个COM服务器简直是小菜一碟。
Making a com server in csharp example at codeproject . codeproject的 csharp示例中制作com服务器。

I've used JACOB in the (distant) past, and it seemed to get the job done. 我在很久以前就使用过JACOB ,它似乎可以完成工作。 The price is right, but the documentation is somewhat lacking so that's something to consider. 价格合适,但缺少文档说明,因此需要考虑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM