java - How does it possible that each jar works on linux and windows? -
i know java give powerful advantagte: java code compiled bytecode , bytecode executed jvm, hence java portability. however, there exists functions such implementation depends on operating system.
https://speakerdeck.com/raboof/jvm-hacking (4-th slide)
can see there system-depended c code. how work ? mean same jar
using bind method can executed on windows , linux. after all, bind method on linux , windows can different (number of paramers, name , more).
can explain me?
it's jvm , runtime library magic.
pure java programs consist of bytecode, , jvm interprets or compiles bytecode, local cpu / os can execute it.
then there methods declared "native", , specific java runtime library windows x86 has implementation, x64 version has implementation, linux xyz has yet implementation , on. signature (number , type of parameters) of these native methods same on implementations, buildung common abstraction on windows/linux/macos functionalities wrap.
if need use native methods in code, must supply necessary implementations program (.dll, .so or whatever targetted systems need). luckily, that's necessary java library complete...
Comments
Post a Comment