Chapter 2. Getting Started
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!
”.
Overview
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 theHelloWorld
source file, resulting in the class fileHelloWorld.class
. Thejavac
compiler is supplied ...
Get Java™ Native Interface: Programmer’s Guide and Specification, The now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.