Sign in to follow this  

Integrating .NET components into existing Java app?

This topic is 2046 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a .NET application with several thousand lines that I would like to integrate with a Java application. I have full control of the .NET application, but not over the Java one (ie, have to use it's existing plugin system). What I want to know is what my options are? I tried googling but most options involved J# to convert the Java code to .NET CIL which I cannot do. Some options I can think of:[list=1]
[*]Rewrite .NET app to Java. Obviously not desireable.
[*]Use some conversion tool to convert the C# code to Java once, then maintain the Java version. Is there such a tool?
[*]Use conversion tool to convert C# to Java for each release. I doubt this is possible.
[*]Use some form of bridge.
[/list]
Option 1 would require alot of work and 2/3 would probably require a certain amount of manual editing and would even then probably result in poor code. Therefore option 4 seems like a nice alternative. So would that be possible?

Share this post


Link to post
Share on other sites
The .NET application is a C# WinForms app with lots of custom drawing and some custom controls. Lots of windows. I can't go into too much details about what it does at this point due to NDA, but I can tell you that it's a standalone WinForms app which doesn't use anything particularly obscure in the framework. For this discussion we can assume that it runs on Linux through Mono.

The Java application is Eclipse.

If the bridging solution would be usable on Linux/Mono, then that would be great, but I'm interested in all ideas at this point.

Share this post


Link to post
Share on other sites
It does some calculations, though I wouldn't really say long-running at this time.. Perhaps in the future though (not too unlikely). It may very well receive streaming data (TCP) in the near-future.

Think about it like read-only Excel. You can sort stuff, sum stuff, make charts etc. There can potentially be some processing of the data.

Share this post


Link to post
Share on other sites
... right, but how do they [i]interact?[/i] If you really mean making a winform control fit into Eclipse, your best bet is to port the thing to Java; preferably by hand (especially if done in .NET 3.5 or later). If you just want to get data out of it, then you maybe could setup some service or export process. Without knowing how the bits interact, it's impossible to say.

Share this post


Link to post
Share on other sites
I pretty much really mean I want a Winforms window/control in Eclipse indeed. What about COM/ActiveX/OLE? I know next to nothing about those technologies, but do you think they could be used in some way?

Share this post


Link to post
Share on other sites
[quote]I pretty much really mean I want a Winforms window/control in Eclipse indeed.[/quote]

It's not a realistic goal, but it all depends on budget.

Perhaps the most direct way is to convert .Net app to Mono, then compile that to some assembly, convert that assembly to java bytecode and remap the library classes, then run that assembly on JVM.

Conversions [url="http://xmlvm.org/clr2jvm/"]like these are done[/url], but I don't know how far projects like this go in practice.

sqlite for Java uses such approach. It's in C, compiled to MIPS assembly, which is then mapped/converted to java bytecode which runs directly on JVM. Only issue is it's about tens of times slower than native version. Edited by Antheus

Share this post


Link to post
Share on other sites

This topic is 2046 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this