Click here to Skip to main content
15,906,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to call C# code from Java using JNI
JNI call C++ Library,then C++ call C#

My Code is here

package javacsharptest;

public class JavaCSharpTest {
  public native void display();
    static {
    public static void main (String[] args) {
            new JavaCSharpTest().display();

I got this error,

Exception in thread "main" java.lang.UnsatisfiedLinkError: javacsharptest.JavaCSharpTest.display()V
at javacsharptest.JavaCSharpTest.display(Native Method)
at javacsharptest.JavaCSharpTest.main(

I've already put JavaCSharpTest.dll into C:\Windows\System32

Please Help me:confused:
Updated 2-Jan-11 18:15pm

Take a look at this:
Java Native Interface: Programmer's Guide and Specification[^]

You need proper stdcall function export entries in your dll

Espen Harlinn
Share this answer
when you you use this command :


then the dll file need to be in , x:\Program Files\Java\jdk1.6.0_20\bin

else you can use , System.load("x:\JavaCSharpTest.dll");
Share this answer
Check that your function definition in the C library has been correctly defined (usually by running the javah[^] command against your Java class file.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900