Unique Problem:-Exception in thread "main" java.lang.UnsatisfiedLinkError
843829Dec 22 2007 — edited Dec 24 2007Hi i am new to this forum...Well i was just trying with Simple JNI Program.Here is the code...
PROG.C_
#include<stdio.h>
void show()
{
printf("Hello from C");
}
void main()
{
}
I created an dll file using Borland Compiler command bcc32 -WD PROG.C and got PROG.dll and pasted it in C:\
Here is my Java Code
Main.java_
package jnidemo;
public class Main
{
public native void show();
public static void main(String[] args)
{
try
{
System.out.println("Loading Shared Library...");
System.setProperty("java.library.path", "C:\");
System.load("C:\GLOBAL.dll");
System.out.println("Shared Library Loaded.");
Main mo=new Main();
mo.show();
}
catch(Exception e)
{
System.out.println("Error:"+e.getMessage()+e);
e.printStackTrace();
}
}
}
When i run the Java Program i get the following error.
Loading Shared Library...
Shared Library Loaded.
Exception in thread "main" java.lang.UnsatisfiedLinkError: jnidemo.Main.show()V
at jnidemo.Main.show(Native Method)
at jnidemo.Main.main(Main.java:28)
Java Result: 1
_ _
Well i just couldn't figure out where i went wrong....Please help me.Any help is appreciated.
Thanks in advance.