Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JNI using tools or by "hand"?

843829Sep 18 2008 — edited Sep 19 2008
I am going to be honest and upfront here, I am posing this question because I am scheduled to give a presentation to a lot of people including my Boss and his Boss and even her Boss in the begining of October. I have tried to gather some information on the web about JNI tools and have found that thare are more than a few ways to do JNI but no one really says how much they liked/disliked each method. Since JNI is just a part of my presentation (I figure about 45 minutes worth) I don't have time to try each one of the many options out. In return for any information, if i get enough information to make it worthwhile, I will post the compiled list including credit for information provided to the java community websites.

What I need to know is what you have tried, how it worked for you, and pro's you found, any con's, and if you would recomend it to another.

For example I have tried swig a little.

Tool: Swig
How it worked for me: It got the job done after a lot of manipulation of the C code.
Pros: It was fast and relativly easy on the java side.
Cons: I had to write tons of wrappers to the C code because there was tons of crap swig could not take, arrays were a big hastle with swig. The java generated code was also really hard to read and seems horribly inefficient.
Would I recomend it: NO!

More background info if anyone is interested: I was tasked with this because I suggested we stopped using so many questionable tools to autogenerate code for us and JNI was one of the areas I pointed out we could benefit by doing it by hand. Though I have never done it by hand myself. Since a huge portion of our work is maintaining the code, if we learn how to write JNI by hand and do so not only will the JNI be more readable and efficient, but we will actually be able to maintain it without adding wrappers to C further slowing things down and increasing overhead. Am I wrong?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 17 2008
Added on Sep 18 2008
6 comments
294 views