Build your Java workstation virtually. Watch how source files are compiled, how the operating system finds Java, and how the JVM runs your first program. Every experiment runs locally in your browser.
1. JDK, runtime and JVM — what do you actually need?
Choose a toolset and watch whether it can compile and run a Java program.
Execution flow
CurrentCompletedError
›_ Virtual terminal
System screen
Interactive reconstruction of this step.
What this animation explains
The JDK supplies development tools such as javac and a runtime containing a JVM. A runtime-only installation can run compatible bytecode but does not provide javac. Modern JDK distributions need not ship a separate JRE product.
Try and observe
Select runtime only and try Compile source and run. It stops at the missing compiler. Change the task to Run existing class file and see the JVM execute the bytecode.
2. Install a JDK — virtual workstation
Follow the installation stages for your operating system. The simulator uses JDK 21 as an example.
Execution flow
CurrentCompletedError
›_ Virtual terminal
System screen
Interactive reconstruction of this step.
What this animation explains
Installing a JDK places the compiler, Java launcher and runtime libraries on the computer. A terminal verification checks whether the intended tools are actually accessible.
Try and observe
Play the installation for Windows, then choose Linux or macOS. Watch how the file location and terminal commands differ while the Java tools remain the same.
3. PATH and JAVA_HOME — find the compiler
Watch the operating system search folders for javac. Change the environment configuration and compare the results.
Execution flow
CurrentCompletedError
›_ Virtual terminal
System screen
Interactive reconstruction of this step.
What this animation explains
PATH is an ordered list of directories searched for executable commands. JAVA_HOME commonly points build tools to the JDK root. Setting JAVA_HOME alone does not automatically update PATH; an earlier Java installation may take priority.
Try and observe
Start with JDK bin missing. Watch the search fail. Choose Old JDK first and observe javac 17. Finally select JDK 21 bin first. Change JAVA_HOME separately and see why build tools can disagree with the command line.
4. From Hello.java to Hello World — compile and execute
See the actual relationship between Java source code, bytecode and JVM execution.
Execution flow
CurrentCompletedError
›_ Virtual terminal
System screen
Interactive reconstruction of this step.
What this animation explains
javac translates valid Java source into bytecode in a .class file. java launches the JVM and loads the named class. In this example Java 21 compiler uses its default target, so Java 17 cannot run the resulting class.
Try and observe
Run the valid example. Next choose Missing semicolon and see the compiler stop without creating a new class file. Restore valid code and select Java 17 to see a runtime compatibility error.
5. Write once, run on multiple operating systems
Watch the same compiled class file travel to different JVMs.
Execution flow
CurrentCompletedError
›_ Virtual terminal
System screen
Interactive reconstruction of this step.
What this animation explains
Java bytecode is portable across compatible JVMs, while JVM implementations are platform-specific. Portability also depends on libraries and native dependencies.
Try and observe
Switch between all three target systems. The Hello.class file stays unchanged. Choose No compatible JVM and observe why bytecode alone is not enough.
6. IDE workflow — Eclipse and command line
Compare running the same Java program through an IDE and through a terminal.
Execution flow
CurrentCompletedError
›_ Virtual terminal
System screen
Interactive reconstruction of this step.
What this animation explains
An IDE integrates editing, build tools, run configurations and output. Eclipse commonly uses its own Java compiler (ECJ), while the command-line example invokes javac. Both produce bytecode executed by a Java runtime.
Try and observe
Play both methods and compare the steps. Select an invalid project configuration to see why installing a JDK alone is insufficient if the IDE is configured incorrectly.
7. Diagnose setup errors — repair the workstation
Select a fault and follow the checks that identify its cause.
Execution flow
CurrentCompletedError
›_ Virtual terminal
System screen
Interactive reconstruction of this step.
What this animation explains
Read the error first, then verify the relevant tool, directory, version or configuration. Do not reinstall everything when the problem is simply a missing PATH entry or wrong working directory.
Try and observe
Choose each fault, press Next step and follow the diagnosis. Repeat the final verification after applying the suggested fix on your actual workstation.
8. Actual hands-on setup instructions
Windows
Install a JDK 21 distribution from a trusted vendor. In Environment Variables, set JAVA_HOME to the actual JDK installation folder, for example C:\Program Files\Java\jdk-21. Add %JAVA_HOME%\bin to PATH; keep the intended JDK before older entries. Open a new terminal.
For persistent settings, add the export lines to the appropriate shell startup file. On Linux use your actual JDK root if a build tool requires JAVA_HOME.
Write, compile and run your first Java program
Use the virtual Java workstation below. Edit the message, compile the source, and then run the compiled class. The console shows exactly which command is being demonstrated and where the program output appears.
Learning simulator: supports a Hello class, its main method, and print/println with string, integer or boolean literals. It does not invoke a real JDK or create a real class file. For arbitrary Java programs, use the installed JDK or Eclipse as described below.
Source editor Hello.java
Project files C:\JavaLab
JAVA
Hello.javaSource code you edit
CLASS
Hello.classNot generated yet
Ready to compile.
Compilation and execution flowSource ready
CurrentCompletedError
Command Prompt Simulated
C:\JavaLab> Ready. Type a command or use Compile / Run.
Program output System.out
(Run the program to see output here.)
Step 1 — Why javac Hello.java?
javac is the Java compiler. Hello.java is the source filename. The compiler checks the syntax and translates valid source into JVM bytecode, generating Hello.class. A successful compilation normally prints nothing in the terminal. It does not execute your program.
C:\JavaLab>javac Hello.java
C:\JavaLab>
Step 2 — Why java Hello?
java is the Java launcher. Hello is the class name, not a filename. The JVM loads the compiled class and invokes its main method. The System.out.println statement writes to the terminal (or the IDE Console). Do not append .class to this command.
C:\JavaLab>java Hello
Hello World
C:\JavaLab>
Try and observe: Compile first. Notice that Hello.class appears but Program output stays empty. Run next and observe Hello World. Change the quoted text and compile again to see the new output. Try the syntax-error button and compile: the missing semicolon prevents a successful build. This simulator invalidates its virtual class whenever the source changes; on a real computer an older class file can remain, so always check that the new compilation succeeded.
Run on your actual computer
Save the source as Hello.java. Open Command Prompt or Terminal in the source folder and run javac Hello.java, then java Hello. If your classpath is configured differently, use java -cp . Hello. In Eclipse, configure the installed JDK under Java → Installed JREs, create a Java project, add the Hello class with a main method, and choose Run As → Java Application. Look for the Console tab, usually at the bottom of Eclipse. Menu wording may vary.
9. Test your understanding
Key takeaway
Install a JDK, verify the compiler and runtime, configure the environment, compile a source file and run the resulting class. These experiments, including the restricted first-program compiler simulator, are educational simulations; they do not install software, execute arbitrary Java or modify your computer.