JNI complex java objects

Posted on 2006-04-11
Last Modified: 2013-11-23
Hi and thanks in advance,
I am using JNI interface to call a C++ library. On some of the library functions I have to pass complex structures. What is the best way to do it?
Question by:aquasw
    LVL 86

    Expert Comment

    Create a Java class with the correct fields. On the native side, unpack them and forward to C++

    Author Comment

    Can you explain what do you mean by "unpack them and forward to C++". It's not a list of parameters it's a tree structure.
    LVL 86

    Expert Comment

    Then you need to pass a class that encapsulates a tree

    Author Comment

    How do I brows a java object that was pass to the c++. it's a jobject what can I do with it?
    Can I get the members of the object?
    LVL 86

    Accepted Solution

    You can manipulate objects in native code by getting their fields. I suggest you take the Sun JNI tutorial


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Title # Comments Views Activity
    wordsWithoutList  challenge 24 61
    scoresSpecial  challenge 13 34
    sumDigits  challenge 7 40
    noX challenge 17 53
    After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
    This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
    Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now