So I got to know that javac compiler is written in Java. And JVM converts the bytecode (compiled Java code) to machine code for execution.
Two questions:
I'm assuming the initial javac was written in C and the modern Java compilers are compiled using the primordial javac (written in c).
If javac is written in java, does compiling a java code require the JVM to start?
Yes, running javac requires a JVM or some equivalent way to execute Java code. (You could, I suppose, precompile it as a native image with GraalVM or the like.)
If javac is written in java, what compiler compiled javac?
There might have been a primordial C compiler long ago, but it would only have been needed at the very beginning, and it certainly wouldn't be needed anymore. These days, the previous version of javac can compile the next version of javac.