[英]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 . 我发现了两个显然可以做到这一点的产品: Java2COM和Java 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部分尝试jpype或jni4net 。
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服务器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.