And I do not think that tomcat(or any other compiler uses.) uses javac.exe for that..
There are classes available in tools.jar for compiliig java files at runtime.
Older versions of Tomcat used javac for this; these days it ships with the Eclipse Compiler (JDT). It did't use javac.exe, because that's just a command-line wrapper around the javac classes, but instead used the compiler classes directly (chiefly com.sun.tools.javac.Main).
But neither JDT nor javac work in-memory - both write .java and .class files to disk. You can find those in the
work directory of your Tomcat installation.