All language compilers translates source code into machine code for a specific computer. Java compiler also does the Sam erhing.
Now the question is how does the Java achieve architecture or operating specification neutrality?? The answer of this question is that the Java compiler produces an intermediate code known as bytecode for a machine that does not exist. This machine is Java Virtual machine and it exist only inside the computer memory. It is a stimulated computer within the computer and does all major functions of a real computer.
The virtual machine code is not machine specific. The machine specific code ( machine code) is generated by the Java interpreter by acting as an intermediary between the virtual machine and real machine.