I know what the JIT compiler is but how about why is it called that, it obviously catches exceptions Just in Time, but how and why should it be called this?
Sorry if this sounds a bit vague.
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.Sign up to join this community
The Just-In-Time compiler doesn't have anything to do with exceptions. It refers to when code is compiled. Some languages, like Java, are translated from the language that you program in with your favorite editor into byte code. At runtime, some byte code might be further compiled into native code just prior to execution (hence the name, just-in-time). This is in contrast to some languages, like C, that are compiled into native machine code at the time when you invoke the compiler.
The name comes from the "just in time" manufacturing methodology, wherein parts are delivered "just in time" to be installed. In manufacturing, it costs a lot of money to keep parts and supplies in inventory, and producing and delivering them as they're needed makes a process cheaper/more efficient.
The Java JIT compiler works in a way that's analogous to JIT manufacturing: instead of compiling code beforehand and keeping it around, it compiles code as its needed. This gives you short development cycles and immediate feedback of an interpreted language and the speed of a compiled language.
In .Net, say when a C# program is compiled, it is compiled into what is called "Microsoft intermediate language" (MSIL) Code, this code is machine independent. The MSIL Code is not directly executable as is. It must be converted (and optimized) to code that can be executed by the target OS (and CPU). That conversion occurs when you request a .Net program to run and is performed by the Just In Time (JIT) compiler, the JIT produces executable that is specific to OS (and CPU) you are running the application on. So the name Just In Time, indicates that the compilation from MSIL to native OS code only occurs when you request the code to execute. For more information see Compiling MSIL to Native Code.