Java / GraalVM Interview questions
Difference between Espresso and running native Java bytecode on the JVM?
Espresso is a Java bytecode interpreter implemented as a Truffle language, meaning it runs Java bytecode as a guest language on top of GraalVM, rather than being the host JVM itself.
| Standard JVM execution | Espresso (Truffle-based) |
| HotSpot interprets/JIT-compiles bytecode as the host runtime | Bytecode runs as a guest language inside a polyglot Context |
| Direct native execution, no host/guest boundary | Can be embedded and interop with other guest languages via the polyglot API |
| Cannot itself run inside another JVM as a guest | Enables running Java inside Native Image executables as a guest VM, or sandboxing untrusted Java code |
The practical use case for Espresso is things a normal JVM can't do: running Java as an embeddable, sandboxable guest inside a polyglot application, or even inside a Native Image binary, which is otherwise not something a standard JVM setup supports.
More Related questions...