Jan 24, 2026
## Chapter 2: Setting Up Your Machine
I won't spend much time on this because it's just clicking "Next, Next, Finish". But there is one thing that makes students cry: **The PATH variable.**
When you type `java` in your terminal (command prompt), your computer needs to know *where* the `java.exe` file is hiding. It doesn't go searching your whole hard drive; it only looks in the folders listed in the **PATH**.
**If you see "Command not found":**
It means you didn't tell your computer where you installed Java.
1. Go to Environment Variables.
2. Find `Path`.
3. Add the `bin` folder of your JDK (usually `C:Program FilesJavajdk-17bin`).
### Examples for Chapter 2:
**1. Basic Check (The "Are you there?" test):**
Open your terminal and type:
```bash
java -version
```
If you see `java version "17.0.x"`, you are successful.
**2. Common Mistake (The "Wrong Version" trap):**
Sometimes a student has Java 8 installed for some old game, and they install Java 17 for class. They type `java -version` and see "1.8".
*Teacher's comment:* This happens because the old Java folder is *higher* in the PATH list than the new one. The computer picks the first one it finds. Move the Java 17 path to the top!
**3. Explanation-Focused (What is JAVA_HOME?):**
Many professional tools (like Android Studio) don't look at the PATH. They look for a specific variable called `JAVA_HOME`. It should point to the main JDK folder (NOT the `bin` folder).
*Analogy:* PATH is like your "Current Location" for the terminal, but `JAVA_HOME` is like your "Home Address" for other apps.
**4. Real-Life (The "Professional Setup"):**
Most developers use **IntelliJ IDEA**. It's like a super-powered notepad that tells you when you make a mistake before you even save the file. I suggest you start with a simple text editor or VS Code for the first week so you learn the hard way, then switch to IntelliJ.
**5. Future Hint (Multiple Versions):**
Later in your career, you might use a tool called "SDKMAN" or "nvm" for Java. It lets you switch between Java 8, 11, 17, and 21 with one command. Don't worry about it now, but know that pros don't just have one Java version.