Thx for reply Michael,my C code is also loading WINAPI aspi.dll.I have put print statement before and after load Library .so i am sure control is reaching just before the statement.but not printing after.So just want to know why its taking so long to Load the library.and as i have told earlier no exceptions.
No its just hanging at the loadLibrary statement.
try{
System.out.println("Before Loading-->");
System.loadLibrary ("cygProcessControllerNative.dll");//Hanging here
System.out.println("In After Loading Lib--
}catch (java.lang.UnsatisfiedLinkError e)
{
System.out.println ("Exception in ProcessControllerNative.class"+e);
}
First print statement is getting Printed.
Well, you should not use extension in this call
System.loadLibrary ("cygProcessControllerNative.dll");//Hanging here
should be
System.loadLibrary ("cygProcessControllerNative");//Hanging here
But my question was - are you sure your DLL is workable and not corrupted? Can you load your cygProcessControllerNative dll not from Java but from other C application for example?
If the dll load line is "hanging" then the problem is in the library and it has nothing to do with java nor even with JNI.
Windows dlls have a method calls something like DLLMain() which gets called when a dll is loaded. That is an OS operation not a java one.
If that never returns then the dll will never finish loading.
If your dll references other dlls then the samething can occur with those other dlls (the main method never returns.)
Repeating it again....none of this has anything to do with java nor JNI.
Thx for sharing the knowkedge,but not sure how to make problem free dll.i have structure like this....
1.java file containing main method and loading lib.
2.java file containing native method decleration.
3.java file containing filelds.
4.c file implementing native methods.
can you tell me steps,how to make it work.
> Thx for sharing the knowkedge,but not sure how to
> make problem free dll.i have structure like
> this....
> 1.java file containing main method and loading lib.
> 2.java file containing native method decleration.
> 3.java file containing filelds.
> 4.c file implementing native methods.
>
> can you tell me steps,how to make it work.
Make what work?
If you can't load the library then you can't do anything in java.
If you can't load the library then it has nothing to do with java nor JNI.
And I already pointed out the most likely reason for it hanging. Or perhaps the only reason (a load error would produce an exception.)