First things first. As is customary in programming books, the author starts with a "Hello, World" example, except here, the program is written in both C and Java. Gordon walks you through the source code in each language, explains compilation, and quickly gets to the mechanics of using the javah utility to generate an include-able .h file.
After the procedural walk-though, Gordon strides into specifics, such as how to get a C/C++ program to set a variable that exists in a Java program and how to deal with native types. He compares object architectures and gets into some detail on arrays, strings, exceptions, and producer-consumer relationships. You'll find plenty of information on input and output, too--the author shows the means of writing to POSIX and Win32 ports. A cool chapter has to do with setting up the Java Developer's Kit as a Windows NT service via the Service Control Manager.
A full JNI class reference with minimal annotation ends the book.
Product Details
Would you like to update product info or give feedback on images?
|
|
Share your thoughts with other customers:
|
||||||||||||||||||||||
|
Most Helpful Customer Reviews
20 of 20 people found the following review helpful:
4.0 out of 5 stars
If you HAVE to use JNI, this is a good book,
By
This review is from: Essential Jni: Java Native Interface (Essential Java) (Paperback)
Let's be clear here, after working with JNI in several capacities for the better part of a year, I know one thing: If you can avoid using JNI, you will be for the better.JNI is unwieldy, unstable, buggy, and most of all, it creates a whole class of run time errors that will blow up your JVM. Of course, if you are smart, you will only use it for one small thing and it will work like a charm. Get out while you are ahead! If you ignore my advice and still use this evil technology, this book is a must have since there are no good docs on using JNI anywhere. The secion regarding how to hook up a C debugger to the VM is a must read. The book is well written and is a multi-use book that can be read before using JNI to become familiar, and then be kept on hand as you go through annoying problem after annoying problem. This book becomes a necessity reference during that tiring time. You have been warned.
7 of 7 people found the following review helpful:
5.0 out of 5 stars
This book is what Sun's docs SHOULD have been (and more),
By Buzzy Brown (Wake Forest, NC, USA) - See all my reviews
This review is from: Essential Jni: Java Native Interface (Essential Java) (Paperback)
FYI, I reviewed a close-to-final draft of the book sent to me by the publisher. Some of this may be innacurate with respect to the published copy. Sun's JNI documentation is rather dry and is really just reference material. This book is a lot more readable. It describes the JNI functions in a logical manner without just saying "here they are and here's what they do". The author also took time to explain the situations where certain functions would be more appropriate. Some books that I've read take up many chapters hand-holding the reader by explaining how great the internet is or showing samples (with screen captures even) of how to compile source code. This book, however, gives only a brief overview of the history of JNI and then jumps right into the code...very nice! Sample code is used appropriately. Small examples of all APIs are given, without trying to tie them into a "full application". This makes it easier to use the book as a reference. However, there were two chapters dedicated solely to some interesting example code (a Serial I/O example and writing an NT Service)...this made it easy to skip if I didn't want to read them. Nice JNI reference in the appendix. The book seems to address both the Win32 and Unix/Sun environments equally well without making a blind assumption that the reader uses a specific one. (OS/2, MacOS, Linux, and BeOS weren't mentioned, though :-)
9 of 11 people found the following review helpful:
3.0 out of 5 stars
Skimps on too many areas,
By A Customer
This review is from: Essential Jni: Java Native Interface (Essential Java) (Paperback)
Easy to read and covering many areas of JNI usage. However, when one settles to write an application in earnest, the book starts feeling superficial. The reference is meager on the Sun web page and not enhanced in the book. For instance, here's a typical argument explanation: "clazz: a Java class object". No indication as to what the usage really is, just a statement of what type it is. This sort of treatment is unfortunately typical. Memory management is barely touched, and many areas are not covered. I expect to be told if a particular method manages memory or not, so I can take adequate care in my application. I expected a detailed discussion on how Java and corresponding C/C++ buffers are managed in general; How to navigate through objects to data that may not be directly available from the calling object; How to access Java static functions, like the utility libraries from native code (or a discussion why not). etc... Examples are provided and thoroughly explained in the "Guide" part of the book, but are by no means a comprehensive coverage of the usage and features of JNI. I rate it 3 stars -- a good introduction, but not a workhorse desk reference. Good to borrow and read through to see how JNI works, but one needs more substantial information to trully write JNI code as part of an application.
Share your thoughts with other customers: Create your own review
|
|
Tags Customers Associate with This Product(What's this?)Click on a tag to find related items, discussions, and people.
|
|
This product's forum
Active discussions in related forums
Search Customer Discussions
|
Related forums
|