我在哪里可以找到Java本机方法实现?

时间:2011-08-22 15:06:07

标签: java jdk1.6

  

可能重复:
  Where to find source code for java.lang native methods?

在哪里可以找到JDK 1.6 Windows平台的Java本机方法实现?

2 个答案:

答案 0 :(得分:0)

这是Googles Dalvik VM如何实现它,我无法想象窗口或任何其他版本会有太大的不同。

 241 /*
 242  * static long currentTimeMillis()
 243  *
 244  * Current time, in miliseconds.  This doesn't need to be internal to the
 245  * VM, but we're already handling java.lang.System here.
 246  */
 247 static void Dalvik_java_lang_System_currentTimeMillis(const u4* args,
 248     JValue* pResult)
 249 {
 250     struct timeval tv;
 251 
 252     UNUSED_PARAMETER(args);
 253 
 254     gettimeofday(&tv, (struct timezone *) NULL);
 255     long long when = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
 256 
 257     RETURN_LONG(when);
 258 }

Source

答案 1 :(得分:0)

这取决于您使用的是哪个VM。可以在此处找到Sun / Oracle JDK的源代码:

  

http://download.java.net/jdk6/source/