How Java linker works?

Viewed 16259

I want to know how Java linker works. Specifically, in which order it combines classes, interfaces, packages, methods and etc into jvm-executable format. I have found some information here, but there is not so much information about linking order.

5 Answers

Linking is one of the three activities performed by ClassLoaders. It includes verification, preparation, and (optionally) resolution.

Verification : It ensures the correctness of .class file i.e. it check whether this file is properly formatted and generated by valid compiler or not. If verification fails, we get run-time exception java.lang.VerifyError.

Preparation : JVM allocates memory for class variables and initializing the memory to default values.

Resolution : It is the process of replacing symbolic references from the type with direct references. It is done by searching into method area to locate the referenced entity.

Related