-
13
pages
-
English
-
Documents
Description
1, 2Using The Java Native Interface
by Christopher Batty
Department of Computer Science, University of Manitoba, Winnipeg, Manitoba, Canada
Last revised: October 23, 2003
Overview:
In this tutorial we illustrate how the Java Native Interface (JNI) can be used to permit
Java programs to communicate with C programs. We begin by compiling the Java
program and the C program at the command prompt (i.e. outside of Eclipse) using the
MinGW gcc compiler. Once the programs are compiled and executing correctly, we
show how the programs can be integrated into an Eclipse project using the CDT plugin.
Requirements:
The first portion of the tutorial makes the following assumptions:
- you are using Windows;
- you have installed Java and Eclipse;
- you have installed and setup the MinGW tools as described in the Eclipse
Project CDT Plugin Tutorial available from the University of Manitoba
(http://www.cs.umanitoba.ca/~eclipse/7-EclipseCpp.pdf).
Note: This tutorial makes use of code adapted from Sun’s JNI tutorial which is located at
http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/index.html. If you are
interested in learning more about the JNI, this is a useful site to visit.
A Summary of the JNI
The essential idea behind the JNI is that in Java we sometimes want to access
functionality that is unavailable to us through the standard Java class libraries. The
functionality may be native to the particular operating system we are using, we might ...
by Christopher Batty
Department of Computer Science, University of Manitoba, Winnipeg, Manitoba, Canada
Last revised: October 23, 2003
Overview:
In this tutorial we illustrate how the Java Native Interface (JNI) can be used to permit
Java programs to communicate with C programs. We begin by compiling the Java
program and the C program at the command prompt (i.e. outside of Eclipse) using the
MinGW gcc compiler. Once the programs are compiled and executing correctly, we
show how the programs can be integrated into an Eclipse project using the CDT plugin.
Requirements:
The first portion of the tutorial makes the following assumptions:
- you are using Windows;
- you have installed Java and Eclipse;
- you have installed and setup the MinGW tools as described in the Eclipse
Project CDT Plugin Tutorial available from the University of Manitoba
(http://www.cs.umanitoba.ca/~eclipse/7-EclipseCpp.pdf).
Note: This tutorial makes use of code adapted from Sun’s JNI tutorial which is located at
http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/index.html. If you are
interested in learning more about the JNI, this is a useful site to visit.
A Summary of the JNI
The essential idea behind the JNI is that in Java we sometimes want to access
functionality that is unavailable to us through the standard Java class libraries. The
functionality may be native to the particular operating system we are using, we might ...
-
Publié par
-
Langue
English