Skip to main content

jvm

We can't directly run a single line of code e.g. printing "hello, mother" as we can do in jshell.

JVM itself is platform dependent because

e.g. we can run JVM in iOS

How JVM Works

JVM runs java application. jvm job is to execute java code, but it will not accept java code.

To run java code in jvm we have to give [[byte-code]]. JVM only understands byte code.

To run code, we have to specify the starting point of the application. The execution start from the first file and the first file need to have the [[main]] method.

java code => (compiler(javac)) => byte code => (run on JVM) => output

For running Java code, JVM needs JRE.