views:

419

answers:

5

Is it possible to write a user interface in Java for an application written in C#?

I am working on a user interface of a project that is written in C#, but I have no experience with C# and I am an avid Java user. Is it possible to build the user interface in Java using Java's Swing and AWT libraries that operates an application primarily written in C#.

If this sounds like a really stupid question, I apologize in advance.

+3  A: 

You might be able to leverage some of the interoperability features that are integrated into Mono 2.0

http://www.mono-project.com/Main_Page

JNBridge is another possible interoperability solution:

http://www.jnbridge.com/

However, a more optimal approach might be to expose your .NET code as Services - and then access them from the Java client (or through a light-weight ESB).

Of course, time, budget, resources are constraints you'll have to consider.

Kelvin Meeks
A: 

We did this recently and went the route of using a low level socket connection, but pushing xml through it. C# was the server side, and we used the Microsoft 'xsd' tool to generate the XSD schema for the objects and then used JAXB on the java side to generate java code to parse and hold the same objects.

As Barry mentions most of the work/problems was around the socket connection - but that depends on how comfortable you are with that.

Chris Kimpton
+1  A: 

In addition to http://www.jnbridge.com (proprietary) you can try http://www.janetdev.org, - open source implementation of a Java 5 SE JDK environment for the .NET platform. Currently it supports .Net 3.5 only (not Mono).

macropas
A: 

Also, for a solution that cross-compiles your java to run in the CLR: http://www.ikvm.net/

mackenir
A: 

I am author of jni4net, open source interprocess bridge between JVM and CLR. It's build on top of JNI and PInvoke. No C/C++ code needed. I hope it will help you.

Pavel Savara