开发者

Identify library file/Source that contains native method implementation

开发者 https://www.devze.com 2023-03-19 09:45 出处:网络
How to identify library file that contains implementation of native methods ? Ex. public native String intern();

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 ?


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


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


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号