Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 666963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:52:35+00:00 2026-05-13T23:52:35+00:00

The examples for JNI i’ve seen map Java native methods to implementation by C++

  • 0

The examples for JNI i’ve seen map Java native methods to implementation by C++ global functions. Is there a way to set the native methods implementation to be the member functions of a C++ object instead?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:52:35+00:00Added an answer on May 13, 2026 at 11:52 pm

    JNI doesn’t know anything about your C++ classes. It just allows you to implement the methods of your Java classes using native code. The C++ functions you write are the methods of a Java class so it doesn’t make sense to simultaneously make them methods of a different C++ class.

    If you are worried about namespace pollution you can use RegisterNatives to manually set up the link to the native methods. Doing so would allow you to name the functions the way you want, put your native functions into a namespace, or declare them as static to keep their symbols from being exported. I suppose you could use this approach to link to a static method of a C++ class but I seriously doubt it would make your code any easier to understand, especially if on the Java side the method is non-static.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I followed this tutorial http://www.ibm.com/developerworks/java/tutorials/j-jni/section2.html (C implementation) for implementing a simple example of JNI
Java Native Interface (JNI) Java Native Interface (JNI) is one of the intersting interface
For example, there are two different JNI methods of the SAME object class JavaObj{
I'm following a basic tutorial for the android jni development at http://permadi.com/blog/2011/12/running-android-ndk-examples-using-eclipse-and-sequoyah/ . Before
I read a lot of examples to retrieve a java string in C/C++ code,
I am implementing the simple JNI example , as given in http://java.sun.com/docs/books/jni/html/start.html At the
I'm starting to learn java's JNI to use with an android device. As I
Anyone out there used MATLAB's javaObject() function with a JAR file that uses JNI?
So i have this C++ program that is called via JNI from my Java
I'm a Java developer by trade and my exposure to C++ / JNI has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.