Java integration with C # .net

Is the following possible: if so, how?
I have some basic functionality already implemented in Java. Now I want to create a GUI for it. I am having a hard time creating GUI in Java using Swing. I can easily create a GUI in C # .net.
So I wondered if it is possible to create a library in Java that I can access from my C # code.
Shorty:my java code will provide some API and then my C# program must be able to call those APIs.

How to do it?

+2


source to share


4 answers


Depending on what your java library is doing and if it uses a lot of 3rd party components, but thanks to IKVM, you can compile a jar file into a .NET assembly. I have used this approach to successfully integrate xhtmlrenderer java library into C # application.



+3


source


Assuming you structured your Java code correctly, create SOAP and just depend on that C # interface.



The great side to this solution, of course, is that if you do it like this, you can completely replace the UI at any point you want, and the downside is that you have to run the Java part separately in a context like as a servlet container that can be heavy enough for your needs.

+5


source


Yes it is possible.

Take a look at JNBrige: http://www.jnbridge.com/

But to be honest, I think it would be better to rewrite your APIs in .Net. Eventually it becomes easier for them. I prefer to work in the same environment and not support things in different places.

+2


source


Do you consider using web services? You can also execute a java program using something like:

private void calljava(object ob,EventArgs arg)
    {
        Process.Start("j.bat");
    }

      

There is also JNBridge

A few ideas ....

+1


source







All Articles