I would like to know if it is possible to get the Native Code implementation of JDK methods, such as:
public final class System {
/* First thing---register the natives */
private static native void registerNatives();
...
....}
I would like to know if it is possible to get the Native Code implementation of JDK methods, such as:
public final class System {
/* First thing---register the natives */
private static native void registerNatives();
...
....}
Search for OpenJDK source code (it is open source), or any other open-source Java implementation and you can find the implementations.
The System class source for example (grabbing the complete OpenJDK source might be more convenient than this 'web view').
Note: registerNatives()
is using native (C/C++ ?) code, so you'd need to track that down (from the complete source code for example). Or any other implementation you are interested in.
Above part of code is not enough to implement native method, you can find detailed information http://www.javaworld.com/javatips/jw-javatip23.html
All this is available from the OpenJDK Mercurial repo web view, but it is far from trivial to track down.
This here is a link to java.lang.System
native code in the newest development version of JDK 7 Update stream. Hopefully you'll find your way around from there.