Java provides a standard mechanism to access native methods\applications aptly named Java Native Interface or JNI, for short. Despite its many benefits JNI has certain drawbacks. Though JNI is Java, the developer still needs to know a lot more about the native component and the target architecture before accessing its services. He\she has to be proficient in Java as well as the native programming language (some open source projects are trying to address this complexity i.e. trying to abstract JNI itself). With increasing demands to deliver on time – before time, and the delivery having due quality, it is not an easy task to find such cross platform resources. The native and the Java layers are so tightly coupled that having dedicated resources does not prove worthwhile either.
JNI takes away one of the most powerful features of the language itself, platform independence (write once, run anywhere). It binds the application to the host platform, for e.g. when using JNI within Windows environment, the Java application is forced to rely on the native DLLs for its functionality. The same application cannot be ported without porting the library to another platform.
Another feature lacking in JNI is allowing for cross platform development without an intermediary, for example consider a COM component providing Weather service. This would only benefit a Java application on Windows platform. For getting Weather details on UNIX, developer would be required to customize this application and go for something of a proxy (UNIX)-stub (Windows) approach. In general, JNI always requires a (stub\native) liaison between Java and the COM component.
The Architectures built on JNI look more or less like figure 1.
Where does j-Interop fit in all this? j-Interop library implements the DCOM protocol and enables development of Pure, Bi-Directional, Non-Native, Java applications which can leverage the features provided by any COM component. The implementation is itself purely in Java and does not use JNI to provide COM access. Please refer to figure 2.
Figure 2 is also, normally how a Windows COM client communicates with its COM server. j-Interop does this as well and so for the COM server it is like an ordinary COM client. Whether the Java application is on Windows or UNIX, it does not matter.