通过消费COM或Java中直接集成一个.net库 [英] Consuming a .Net library via COM or direct integration in Java

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

问题描述

我不得不承认,我最后一次用Java编程是一个数据结构类高中。所以,请善待这个Java菜鸟。



我已经花了很多时间一个很好的协议在工作中组建了一个C#COM库。该库在很大程度上依赖于一些新的.Net技术(WPF是最大的一个),所以它翻译成另一种语言是不是一个真正的选择。我已经测试耗时从C ++通过COM接口,这个库,那就是很简单。我想也证明了这同一个库可以从Java程序中使用。



所以,我碰到的问题是,我无法找到使用COM对象从Java的自由,甚至廉价的方式。我想其他的解决办法是找到一个方法来图书馆直接集成。有没有人有什么可能是实现这一目标的最佳途径的任何输入?我使用Eclipse为我的Java环境。下面是什么我的C#代码曝光看起来像一个例子。感谢您能提供任何方向。

  //例C#目标代码

[Serializable接口,
ComVisibleAttribute(真),
的Guid(长GUID字符串),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof运算(IFooBarStructure)),
进程id(我的应用)]

公共类MyFooBarObject
{

公共MyFooBarObject(){}

公共字符串DotNetMethod(){返回的String.Empty; }

}


解决方案

如果你有一点钱花费在一个商业产品,我建议你看一看Intrinsyc公司的的 J-的Integra为COM J-的Integra的。 NET 产品。我用自己的COM产品来访问Java代码的第三方ActiveX控件(彭博社的数据访问库)为一个项目前,我在工作了几年,和它的工作非常出色。他们有一个合理的试验/演示的政策,他们是非常敏感,支持的请求。


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.

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.

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; }

}

解决方案

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或Java中直接集成一个.net库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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