I was following a tutorial video on compilers on YouTube, when I came across the fact that the C Programming Language is faster because it allows both static linking and dynamic linking, but Java allows only dynamic linking and that is why C is much faster than Java.
My question is, if static linking makes a program run faster, why was it not included in Java? I know there must be some real good reason why this decision was taken by the developers of Java to not include static linking, I just want to know what are the reasons.
Note : I do not know if this question already has an answer on SO, but since I could not find one, so I posted. If the answer does already exist, please provide a link to it.
Note : The link to the tutorial provided is in Hindi Language. Sorry about that.
Java does not include a linker step at compile time. With Java 9 there will be a tool (jlink: JEP 275, JavaOne Talk on Project Jigsaw) which will create an image that will have the dependencies linked in.
One of the main goals of Java when it was created was "Code once, run everywhere". Statically linking environment dependent libraries or code parts in will negate this feature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With