Courses
Java
Home
Corporate
Consulting
Contact Us
Courses
Jobs
Custom Topics

Customize this course,
choose your topics

Building Your Course
Custom Order Page
Building Guidelines

Selectable Topics
Advanced Applets
Advanced AWT
Collections
CORBA
Custom Components
Drag'n Drop
Enterprise JavaBeans
Event Delegation
GridbagLayout
InfoBus
Inner Classes
Internationalization
Java 2 Overview
JavaBeans
JFC Overview
JSP (Java Server Pages)
JSP Tag Libraries (taglib)
JDBC
JNI
RMI
Security
Serialization
Servlets
Struts
Swing
WebServices Overview
XML

Java Native Interface (JNI)

Java Native Interface is a C/C++ API that allows Java and native code to interact in an application. JNI allows the programmer to implement some or all methods of a Java class in C or C++. JNI also allows the programmer to embed the JVM into a native application.

Native methods (written in C or C++) can access instance members associated with that object. They can also access class members, create objects, call methods on objects, throw exceptions, etc.

Objectives

At the end of this section you will be able to:

  • Write a Java class with one or more of its methods being implemented in C or C++
  • Within a native method, access instance members (of the same object) or class members (of the same class)
  • Handle arguments (Objects, or primitive data) of a natives methods. If receiving an object, you will be able to call methods on that object from within the native method.
  • Create new objects and return them from a native method
  • Make your native method throw exceptions.
  • Use the javah tool to generate method signatures for your C or C++ code.
  • Load a native library (eg., a .dll file) into a JVM.

Specifications

  • Duration (total): 1.5 hours
  • Duration of Exercises: 30
  • Duration of Lecture: 1 hour

Pre-requisites

Material covered in this module requires attendees to know the following:

  • Basic Java knowledge including exception handling, threads, full use of all the language constructs, and familiarity with the core Java 1.1 APIs.
  • Those without these pre-requisites should consider one of our Ultimate Java Programming Workshops.

A table of contents of this module is available upon request.

Return to the Custom Order Page.

Copyright ©2007 by Petronio Technology Group, Inc. All rights reserved. Petronio, "Targeted Technology Training", "T3" and "Turning new technologies into your competitive advantage" are trademarks of Petronio Technology Group. All other trademarks are the properties of their respective companies.