June 1999
Intermediate to advanced
320 pages
5h 20m
English
This chapter walks you through a simple example of using the Java Native Interface. We will write a Java application that calls a C function to print “
Hello World!
”.
Figure 2.1 illustrates the process for using JDK or Java 2 SDK releases to write a simple Java application that calls a C function to print “
Hello World!
”. The process consists of the following steps:

Figure 2.1. Steps in Writing and Running the “Hello World” Program
Create a class (HelloWorld.java) that declares the native method.
Use javac to compile the HelloWorld source file, resulting in the class file HelloWorld.class. The javac compiler is supplied ...
Read now
Unlock full access