开发者

Easiest way to call Java from C#?

We have a major body of code in Java that runs on the desktop that we want to reuse with a MS.NET user interface (desktop rather than web). Any do's or don'ts would be very welc开发者_开发知识库ome.


You may want to take a look at IKVM.

It is an implementation of the Java Virtual Machine on top of the .NET Framework. There are some parts dealing specifically with interoperability of the .NET and Java worlds so you can (more or less) seamlessly use one from the other.


I suggest creating web services for existing java code to act as a wrapper and call them from .net app. (desktop or web)


If you have the $$$$ you can try mainsoft; it converts your java code in C#, or vice versa, depending on your whim.

Eric Sink has a post about this.


Another possible solution could in the the form of j-interop

I've used it successfully for calling from Java -> DCOM and it claims to be able to do bi-directional stuff so in theory it should be possible to register a Java process as a DCOM server.

You will need to do a bit of work on the java side as it won't be able to just make it work automatically.


I agree with the webservices method suggested by "2009MIPS". It offers the cleanest and most "debuggable" way to do it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜