Runtime: The environment a program runs in, or the period while it is running. A runtime error happens while the program is running, not while it is being compiled.
Example
Your code compiles without errors, but when a user searches for a product that doesn't exist, the program crashes at runtime because it tries to read the name of a null product.
Two Meanings of Runtime
| Meaning | Example |
|---|---|
| The time when the program runs | "This error only appears at runtime" |
| The environment that runs your code | The JVM for Java, the .NET runtime for C#, Node.js for JavaScript, the Python interpreter |
Compile Time vs Runtime
The compiler catches some mistakes before the program runs, such as syntax and type errors. Other problems only show up at runtime, because they depend on real data or conditions:
- Using a null value. See exception.
- Dividing by zero.
- Reading a file or calling an API that is not available.
- Running out of memory with very large data.
Preventing Runtime Errors
Validate input, check for null or missing data, handle expected failures with error handling, and write unit tests for edge cases such as empty lists and zero values. When a runtime error happens anyway, the stack trace and logs are where debugging starts.
Related terms
- Compiler: catches errors before runtime.
- Exception: the usual form of a runtime error.
- Error Handling: how code survives runtime problems.
- Debugging: how runtime errors are found and fixed.
Previous term: Retrospective | Next term: Scalability
Related guides
- Technical Interview Questions for Freshers
- Java Interview Questions Test
- .NET Interview Questions Test
Frequently asked questions
What does runtime mean?
Runtime means the time when a program is running, or the environment that runs it, such as the JVM or Node.js.
What is a runtime error?
An error that happens while the program is running, such as using a null value or dividing by zero.
What is the difference between compile time and runtime?
Compile time is when code is checked and translated. Runtime is when the program actually runs with real data.
What is the Java runtime?
The Java Runtime Environment, mainly the JVM, which runs compiled Java bytecode.
Explore more internship terms
The IT Internship Glossary explains 199 terms you will hear before and during your internship, with simple definitions and real examples.
Browse all 199 terms