Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame
|Bruce Eckel's Thinking in Java||Contents | Prev | Next|
This appendix was contributed by and used with the permission of Andrea Provaglio ( www.AndreaProvaglio.com).
The Java language and its standard API are rich enough to write full-fledged applications. But in some cases you must call non-Java code; for example, if you want to access operating-system-specific features, interface with special hardware devices, reuse a pre-existing, non-Java code base, or implement time-critical sections of code. Interfacing with non-Java code requires dedicated support in the compiler and in the Virtual Machine, and additional tools to map the Java code to the non-Java code. (There’s also a simple approach: in Chapter 15, the section titled “a Web application” contains an example of connecting to non-Java code using standard input and output.) Currently, different vendors offer different solutions: Java 1.1 has the Java Native Interface (JNI), Netscape has proposed its Java Runtime Interface, and Microsoft offers J/Direct, Raw Native Interface (RNI), and Java/COM integration.
This fragmentation among different vendors implies serious drawbacks for the programmer. If a Java application must call native methods, the programmer might need to implement different versions of the native methods depending on the platform the application will run on. The programmer might actually need different versions of the Java code as well as different Java virtual machines.
Another solution is CORBA (Common Object Request Broker Architecture), an integration technology developed by the OMG (Object Management Group, a non-profit consortium of companies). CORBA is not part of any language, but is a specification for implementing a common communication bus and services that allow interoperability among objects implemented in different languages. This communication bus, called an ORB (Object Request Broker), is a product implemented by third-party vendors, but it is not part of the Java language specification.
This appendix gives an overview of JNI, J/Direct, RNI, Java/COM integration, and CORBA. This is not an in-depth treatment, and in some cases you’re assumed to have partial knowledge of the related concepts and techniques. But in the end, you should be able to compare the different approaches and choose the one that is most appropriate to the problem you want to solve.