I have been given a task to create a bridge between C# and Java. It was said that if we use C# right now, and then we receive a Java file from somewhere else, we should be able to convert that Java file into .NET so it can be compatible with our software. The problem is I don't know what to do or how to even begin this task. Any suggestions or advice?

It was said that I initially have to make platform independent classes, if that helps.

*Edit: Sorry if I wasn't clear the first time, because I don't fully understand the task myself, which is why I am here. But from what I understand, I do have to create the bridge itself where I can call the source Java code from my .NET file. I have several months to finish it, so I assume that I have to make every library in Java compatible with C#.

I looked around for help, and found some similar projects: JNBridge(pay to use), Tangible(free demo), and Janett(open source), so that is what I am basing my opinion from.

**Edit: Let's say for example I create a Calculator class in Java. I would want to create the instance of that class in C#.

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.
If this question can be reworded to fit the rules in the help center, please edit the question.

5

what do you mean by Java file? Java source code (or) data sent by system which was developed in Java (or) some other language?
–
NambariJan 17 '12 at 21:29

Are you wanting to (1) communicate with existing Java-compiled code from C# (like a "bridge"), or (2) port Java code to C# ("convert that Java file into .NET")? Your question isn't at all clear in this respect. And these are completely different things/tasks.
–
James JohnstonJan 17 '12 at 21:30

this is a pretty daunting task...assuming you mean source code, is this even feasible? c# and java have pretty strong similarities but certain constructs dont even exist in java that do in c# and vise versa. for example linq, delegates, dynamic types, anonymous objects, etc..
–
Nadir MuzaffarJan 17 '12 at 21:31

You can convert Java binaries to .NET See ikvm.net
–
L.BJan 17 '12 at 21:32

2

@CodeCaster, Please try IKVM. I used it to convert Lucene, Jericho Html Parser, Mobile Atlas Creator etc binaries to .Net and used in many projects. It is not a joke, it is real. I really can't believe this ignorance.
–
L.BJan 17 '12 at 22:07

Depending on the situation, there are a large number of integration technologies that can be used to bridge two systems. In fact, there is an entire software architecture paradigm devoted to this called a Service Oriented Architecture. Any of the techniques used for inter-service communication can be used to integrate any two systems, no matter the size. There are tradeoffs, of course, but there always are.

Without much more information regarding the systems involved and the level of integration needed, it is going to be very hard for a definitive answer to be found for this question.

From your explanation of what you want your bridge to do, it sounds like JNBridge could well solve your problem and save a lot of time reinventing the wheel. If you have any questions, please contact us at JNBridge -- there's a contact link on the website. (Disclosure: Yes, I work for JNBridge.)