JNI and 3rd party DLL's

Hello everbody

I just recently started working with JNI and third party DLL's and therefore had to go through some painful education. I understand that in order to use 3rd party DLL's it is necessary to write a wrapper in C. However, I am curious and would like to know why it is not possible to link a library directly from Java through the System.loadLibrary() call. Detailed info or links to such are most appreciated.

Thanks,

Joe Weinberg

[469 byte] By [JWeinberga] at [2007-11-27 9:54:06]
# 1

You can't do it because generally the pre-existing DLL exposes an interface that does nott meet java's (JNI) expectations:

o Doesn't take parameters of the type that java wants to pass.

o Doesn't return the type of information that java expects will be returned (if any).

o May have C++ linkage when java expects C linkage.

bschauwejavaa at 2007-7-13 0:23:58 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

I also hate pure JNI (but I am writing JNI code for 7 years). Now I have issued SDK for Java that implements P/Invoke paradigm from .NET. It is called Java Platform Invoke (J/Invoke). This ver. runs only under MS Windows but in near future I plan to recompile J/Invoke SDK for Linux.

See Demo at

http://www.sharewareplaza.com/Java-Platform-Invoke-API-Demo-version-download_49212.html

vitallisa at 2007-7-13 0:23:58 > top of Java-index,Java HotSpot Virtual Machine,Specifications...