What's happening under the hood
Mosh is working with IntelliJ however the concepts are interchangeable. There are two primary steps involved here Compilation and Execution
Compilation
Section titled “Compilation”In the compilation step VS Code is using the Java compiler to compile our source into Java bytecode. You can invoke the compiler by using the javac
command to see your compiled bytecode in a .class
file. When you are using the IDE to run and debug your .java
files the compiled output is held in a mirrored directory structure starting with bin
rather then src
(other IDE’s may have different naming conventions).
Execution
Section titled “Execution”Compiled java .class
files are enabled to be platform independent and can run on any operating system that supports the Java runtime environment.
The Java runtime environment has a component called the Java Virtual Machine (JVM) which takes the Java bytecode from the .class
file and converts it to native executable code of that operating system.