Prateek
Prateek

Reputation: 12242

JDK Native Code Implementation

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();
...
....}

Upvotes: 2

Views: 744

Answers (3)

Marko Topolnik
Marko Topolnik

Reputation: 200138

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.

Upvotes: 1

Veger
Veger

Reputation: 37906

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.

Upvotes: 2

umert
umert

Reputation: 138

Above part of code is not enough to implement native method, you can find detailed information http://www.javaworld.com/javatips/jw-javatip23.html

Upvotes: 1

Related Questions