I know that the way Java works is that the JVM and its Just-In-Time compiler turn the Java bytecode produced by the "compiler" into actual computer code to be run by the target machine. I know that the reason that Java compiles to an intermediary language instead of directly to machine code is because it's much more effective to let the JVM optimize it for the target system rather than compile platform-specific binaries for every possible circumstance.
My question is: once the JVM has fully internalized the classes and done all of its optimizations in the process of running the program, why doesn't it produce a binary that has all of those effects? Why does the bytecode need to be JIT-compiled every time?
I understand the portability JIT offers, I just don't understand why it needs to be done more than once.