3

As the title states, I'm looking for a basic (working) tutorial of Java code that uses JNI to call a "hello world" kind of application written in C#.

The "best" I found is this, but I can't get it to work following the tutorial + the ready to use projects don't build in Visual Studio 2008.

I have to say that I have no .NET knowledge apart from creating a basic project and writing C# code. Once I have working projects I'll do something similar with the DLL (and source code) I received.

Thank you for your time.

1 Answer 1

6

Sounds like jni4net may be of use ? From the intro page:

import net.sf.jni4net.Bridge;
import java.io.IOException;
import java.lang.String;

public class Program {
    public static void main(String[] args) throws IOException {
        Bridge.init();
        system.Console.WriteLine("Greetings from Java to .NET world!");
    }
}

So it looks pretty straightforward. Of course the devil is in the detail.

Sign up to request clarification or add additional context in comments.

4 Comments

I already saw that, but I didn't want to add an extra layer of abstraction just to expose a few (10 - 20) C# methods to Java. Now that it seems impossible to find a basic working "hello world" example, I'll stick with this, thanks!
I have compiled this tutorial from my java-.net bridging experience, Hope it helps : codefry.blogspot.in/2012/01/…
Does invoking C# code from java mean I can also access C# libraries from java?
I would believe so, yes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.