java – Does the JVM compile bytecode into machine code and run it or does it just run bytecode directly?

how does JVM convert bytecode into machine code?

The keyword you need is “JIT compilation”; JIT stands for “just in time”, i.e. it runs immediately before trying to execute the bytecode.

See this explainer from Oracle.

Does it re-compile bytecode into machine code and then run it?

Usually yes.

simply just run the bytecode, directly?

It can’t be run “directly” unless the processor itself supports Java bytecode (ARM Jazelle, never really a success), so if it’s not compiled then it is interpreted, i.e. a program that looks at each bytecode individually and performs the appropriate action.