Java Install and Check the JDK
Use a JDK, a plain source file and a terminal to establish a setup you can explain. An IDE is helpful later, but it should not hide whether the compiler is installed.
Understand the idea
This course uses stable Java 21 language and library features, with additional version notes where relevant. JDK 21 or a later compatible JDK can compile the examples. Open a new terminal after installing a trusted JDK and check both java -version and javac -version. Save the displayed source as Main.java in an empty lab folder. Run javac --release 21 Main.java, then java Main from that folder.
Run it locally
Use a local JDK 21 or newer. Save the complete example as Main.java in a separate lab folder, then compile and run it with the commands below. Java examples do not run in Bhylu’s browser playground. The -ea option enables assertion checks used by some lessons.
javac --release 21 -encoding UTF-8 -d out Main.java
java -ea -cp out MainA worked example
public class Main {
public static void main(String[] args) {
System.out.println("The compiler and launcher work.");
}
}
Expected output
The compiler and launcher work.The compiler reads Main.java and writes Main.class. The launcher receives the class name without .class. With a newer JDK, --release 21 checks this course baseline rather than silently accepting newer APIs. java Main.java is also a source launcher on supported JDKs, but compiling separately makes the two stages visible.
Environment and design notes
Windows setup
Choose an OpenJDK distribution from its official vendor. Install or unpack the JDK according to that vendor’s instructions. Keep a note of its bin folder. If javac is not found, check the JDK installation and terminal PATH; starting Apache or MySQL does not install Java.
Check the official Java documentation for detailed contracts and supported options.