Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting started with JNI

 
Joe Areeda
Ranch Hand
Posts: 331
2
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to a more appropriate forum where JNI questions are usually discussed
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic