A: Using non-Java code | CodeGuru

A: Using non-Java code

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 […]

Written By
CodeGuru Staff
CodeGuru Staff
Mar 1, 2001
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

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.


Contents

|

Prev

|

Next
CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.