Post

Visualizzazione dei post da dicembre, 2013

JNI? there's someone who remembers something?

Java Communications Without JNI JNA is an open source project maintained by Tim Wall that allows you to write Java code only to call into native libraries (i.e., DLLs on Windows). Without JNA, you would have to write potentially complex Java Native Interface (JNI) code or other glue code to make this work. For instance, the following code sample from the JNA Wikipedia page works as-is on Windows, Linux, or OS X, to call the native C runtime  printf  function: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.Platform;     /** Simple example of native library declaration and usage. */ public class HelloWorld {      public interface CLibrary extends Library {          CLibrary INSTANCE = (CLibrary) Native.loadLibrary(              (Platform.isWindows() ? "msvcrt" : "c" ), CLibrary. class );          void printf(Stri