Identify library file/Source that contains native method implementation

北战南征 提交于 2019-12-02 14:29:37

问题


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

Ex.

public native String intern();

Where can I find implementation (source code) of String.intern() method ?


回答1:


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




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/6662214/identify-library-file-source-that-contains-native-method-implementation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!