Search the courses, subjects, tracks, games and features, or jump straight to a page.
5 cards from this section. Quick, good the night before a test.
What do the abbreviations JDK, JRE and JVM stand for?
Development, Runtime and Virtual Machine: one is for writing programs, one for running them, and one is the engine underneath.
Which of the three components contains javac, and what does javac do?
It is one of the development tools that the JRE does not have.
Which component do you need in order to compile Java source code?
Which of the three is the development kit?
What does the JRE contain?
The JRE holds everything needed to run a program, and nothing more.
Build a Java setup checker: a program that prints the Java version, the Java vendor, the JVM name, the folder where the Java runtime is installed (java.home), the operating system with its architecture, and the bytecode version the runtime understands (java.class.version). Then explain which component each printed fact describes, and why two learners running the same program can see different output.
Use `System.getProperty` with the keys "java.home", "java.vendor" and so on; each value comes from the runtime, not from your code.
Run the program below in the code editor. Which message does it print, why, and what would it print on a runtime-only installation? (The program asks Java for its compiler with ToolProvider.getSystemJavaCompiler(), which gives back null, meaning no compiler, on an installation that has none.)
import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;
public class CompilerCheck {
public static void main(String[] args) {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
if (compiler != null) {
System.out.println("A Java compiler is available: this runtime is part of a JDK.");
} else {
System.out.println("No Java compiler here: this is a runtime-only (JRE) installation.");
}
System.out.println("Runtime folder: " + System.getProperty("java.home"));
}
}The compiler is one of the development tools that the JDK adds on top of the JRE.
6 more questions in this section. Enroll free to practise them all.
Enroll free