开发者

Is the source code of native methods available?

开发者 https://www.devze.com 2023-03-15 16:17 出处:网络
At first I want to let you know that this question is not related with What is native implementation in Java. I got many useful information from that thread.

At first I want to let you know that this question is not related with What is native implementation in Java. I got many useful information from that thread.

I want to know that are the codes o开发者_开发百科f the native implementations available? I have jdk source code but I can not find the native codes for System.currentTimeMillis or Runtime.getRuntime().availableProcessors() or other native method.


Yes, see os::javaTimeMillis in /src/os/solaris/vm/os_solaris.cpp to see the Solaris implementation for instance.

There are a few layers of wrappers to get there though, see JVM_CurrentTimeMillis in /src/share/vm/prims/jvm.cpp


Because the underlying methods are intrinsic to the OS you are running Java on, you will not find their source code in the JDK documentation. I suppose you'd need to find out exactly which procedures are called on your platform, and if source code is available for those (which strongly depends on your OS).

0

精彩评论

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