aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Getting started with JNI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Getting started with JNI" Watch "Getting started with JNI" New topic
Author

Getting started with JNI

Joe Areeda
Ranch Hand

Joined: Apr 15, 2011
Posts: 294
    
    2

I have a need to use some C libraries that use a proprietary network transfer transfer protocol. So becoming proficient with JNI is in my future.

I've about exhausted my Google skills but I have learned how to pass Java Objects back and forth, I think. I've been working on a few C++ Objects and their Java counterparts.

What I'm missing, or should I say, the most obvious thing I'm missing, is an understanding of the scope of a C++ object and how to keep it across Java calls.

What I'm thinking is to create a Connection object and a BufferedReader object. There may be more than one of these active at a time. There will be a corresponding Java Object and C++ Object so the Java interface is clean and Java-like.

But, how do I give the pointer to these C++ Objects to Java so subsequent calls can refer to them? I assume if I do a new CObject of some sort that that object will live until I call it's destructor.

I would really appreciate a link to something that describes this process, or any advice how to start.

Thanks,
Joe


It's not what your program can do, it's what your users do with the program.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9995
    
    7

Moving to a more appropriate forum where JNI questions are usually discussed


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting started with JNI
 
Similar Threads
How ensure numbers are correct for os?
JNI crashes calling into C methods with structs
JNI and Crypt
Using JNI
Make call to phone with java + broadband connection?