通过COM使用.Net库或在Java中直接集成 [英] Consuming a .Net library via COM or direct integration in Java

查看:279
本文介绍了通过COM使用.Net库或在Java中直接集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不得不承认,我最后一次在Java编程是一个数据结构类在高中。所以,请对这个Java的noob。

I have to admit the last time I programmed in Java was a data structures class in high school. So please be kind to this Java noob.

我花了很多时间把一个C#COM库放在一起工作。这个库依赖于一些新的.Net技术(WPF是大的),因此将它转换为另一种语言不是一个选择。我已经测试从C ++通过COM接口使用这个库,这是很简单。我还想证明这个相同的库可以从Java程序中使用。

I have spent a good deal of time putting together a C# COM library at work. This library relies heavily on some new .Net technologies (WPF being the big one) so translating it into another language is not really an option. I have tested consuming this library from C++ through the COM interface and that was simple enough. I wanted to also prove that this same library could be used from a Java program.

所以我遇到的问题是,我找不到一个免费或甚至廉价的方式使用COM对象从Java。我想另一个解决方案是找到一种方法来直接集成库。有没有人有什么可能是最好的方法来完成这一点的任何输入?我使用Eclipse为我的java环境。下面是我的C#代码暴露的例子。感谢您可以提供的任何方向。

So the problem that I have run into is that I can not find a free or even inexpensive way to use COM objects from Java. I guess the other solution would be to find a way to directly integrate the library. Does anyone have any input on what might be the best way to accomplish this? I am using Eclipse for my java environment. Below is an example of what my C# codes exposure looks like. Thanks for any direction you can provide.

//Example C# Object Code

[Serializable,
ComVisibleAttribute(true),
Guid("Long Guid String"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(IFooBarStructure)),
ProgID("My Application")]

public class MyFooBarObject
{

   public MyFooBarObject(){}

   public string DotNetMethod(){ return String.Empty; }

}


推荐答案

你有一点钱花在商业产品上,我建议你看看Intrinsyc的 J-Integra for COM J-Integra for .NET 产品。我使用他们的COM产品从Java代码访问第三方ActiveX控件(彭博数据访问库)几年前我工作的项目,它工作得很好。他们有合理的试用/演示政策,他们对支持请求反应灵敏。

If you have a little bit of money to spend on a commercial product, I recommend that you take a look at Intrinsyc's J-Integra for COM or J-Integra for .NET products. I used their COM product to access a 3rd party ActiveX control (the Bloomberg data access library) from Java code for a project I worked on a few years ago, and it worked very well. They have a reasonable trial / demo policy, and they are quite responsive to support requests.

这篇关于通过COM使用.Net库或在Java中直接集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆