简体   繁体   中英

How Native method work inside source code without loading native library inside class?

I was going through source code of FileInputStream, i saw many native method signature, but could not find "System.Load" anywhere inside source code. So my question is how those native method works without loading native library? I tried hard but could not find the right answer

According to the Java Virtual Machine Specs 1.12 a compliant virtual machine must

provide sufficient support for the implementation of the class libraries of the Java SE Platform.

EDIT:

In the specs nothing says that implementation must be done in a separate library. The JVM is allowed to not put the native implementation in a separate library but to have them as part of the JVM code itself. In that case what library should the code load?

I think the assumption here is that the JVM is in charge of having the method properly loaded before it is executed, the library can just invoke it without having to care about loading libraries and such.

In contrast, the native implementation of custom defined methods is in charge of the developer, so he/she must load the native library before invoking the method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM