Identify library file/Source that contains native method implementation

后端 未结 3 441
日久生厌
日久生厌 2021-01-27 16:01

How to identify library file that contains implementation of native methods ?

Ex.

public native String intern();

Where can I find imple

相关标签:
3条回答
  • 2021-01-27 16:41

    Download this JDK 6 library:

    http://download.java.net/jdk6/source/

    and search through sources.

    But I think, some code implementations are not accessible as OpenSource

    0 讨论(0)
  • 2021-01-27 16:45

    There is no general approach to find source code for (any) native method. But if we narrow the question to the native jre methods, then you can find some implementations in the (full) source code of openJdk.

    Just keep in mind that those are the implementations for just one JRE, other implementations of Java may have different implementations of the native methods.

    To find the source for a native method: search the repository for the JNI header files, then you should get the name of the C/C++ function that provides the implementation.

    0 讨论(0)
  • 2021-01-27 16:57

    Found answer for String.intern() with quick google search

    • constant pool
    • symbol table cpp : symbol table hpp

    Yet to find answer for generic way to identify native implementation/library

    0 讨论(0)
提交回复
热议问题