After compilation of a business logic, the .class file is generated in our hard drive. My doubt is, when we execute the compiled code, it has to be loaded somewhere. What is that location?!
The .class
file includes the instructions for the hardware and OS. the .class
file is loaded into the JVM memory (RAM) before the execution of the program and is being handled there.
Compiled code to be executed by the Java Virtual Machine is represented using a hardware- and operating system-independent binary format, typically (but not necessarily) stored in a file, known as the class file format. The class file format precisely defines the representation of a class or interface, including details such as byte ordering that might be taken for granted in a platform-specific object file format.
Taken from: Chapter 2. The Structure of the Java Virtual Machine