views:

88

answers:

3

So I want to wrap a simple java library so to be able to use its functions from C#. Is it possible, how to do such thing?

BTW can we do such thing from C?

+7  A: 

Have you taken a look at http://www.ikvm.net/?? It seems pretty popular and according to the site:

It is an implementation of Java for Mono and the Microsoft .NET Framework. It includes the following components:

A Java Virtual Machine implemented in .NET A .NET implementation of the Java class libraries Tools that enable Java and .NET interoperability

JP
I've used IKVM in the past and it's pretty amazing! Just recompile the .jar into a .dll and you're good to go! Unfortunately, it does require that you also reference the Java runtime library DLL which is a whopping 26MB, but you gotta take the good with the bad :-)
Dean Harding
+1  A: 

There are several ways you can do this.
1) Use web services (Requires a separate process).
2) Use JNI or some other native library.
3) Use some middleware (Queueing system)

Of course either of these would allow 2-way communications

Romain Hippeau
+2  A: 

I find Pavel Šavara's jni4net project very useful for this. It allows you to host the JVM and the CLR in a single process and share objects between them.

Matt Z