appendix was contributed by and used with the permission of Andrea Provaglio ( www.AndreaProvaglio.com ).
appendix was contributed by and used with the permission of Andrea Provaglio (
Java language and its standard API are rich enough to write full-fledged
applications. But in some cases you must call
code; for example, if you want to access operating-system-specific features,
devices, reuse a pre-existing, non-Java code base, or implement
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
Native Interface (JNI), Netscape has proposed its
Runtime Interface, and Microsoft offers
Native Interface (RNI), and
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.
(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
(Object Request Broker), is a product implemented by third-party vendors, but
it is not part of the Java language specification.
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.