Before writing any Java code, your machine needs the right tools. Just like a carpenter needs their saws and levels, a Java developer needs a properly configured setup — starting with the Java Development Kit (JDK) and an Integrated Development Environment (IDE).
Get this right, and you'll be able to code, compile, and debug with ease. Get it wrong, and even printing “Hello World” becomes a nightmare. Let's do it the right way.
The Java Development Kit (JDK) is a software bundle required to develop Java applications. It includes:
✅ Think of it as your entire Java toolbox.
C:\Program Files\Java\jdk-24.0.2
or any safe location without spaces
NewJAVA_HOMEC:\Program Files\Java\jdk-24.0.2 *(❗ do NOT include
\bin)*
Path variable → Edit → Add:
%JAVA_HOME%\bin
[INPUT]: java -version
You should see [OUTPUT]:
openjdk version "24.0.2" 2025-07-15
OpenJDK Runtime Environment (build 24.0.2+12-54)
OpenJDK 64-Bit Server VM (build 24.0.2+12-54, mixed mode, sharing)
[INPUT]: javac -version
You should see [OUTPUT]:
javac 24.0.2
/Library/Java/JavaVirtualMachines/
echo 'export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-24.0.2.jdk/Contents/Home"' >> ~/.zshrc
echo 'export PATH="$JAVA_HOME/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
sudo mkdir -p /usr/lib/jvm
sudo tar -xvzf openjdk-24.0.2_linux-x64_bin.tar.gz -C /usr/lib/jvm/
export JAVA_HOME=/usr/lib/jvm/jdk-24.0.2
export PATH=$JAVA_HOME/bin:$PATH
Add the above to your `~/.bashrc` or `~/.zshrc`
public class HelloJava {
public static void main(String[] args) {
System.out.println("It works!");
}
}
vscjava.vscode-java-pack
HelloVSCode.java:
public class HelloVSCode {
public static void main(String[] args) {
System.out.println("VS Code + Java is ready!");
}
}
Ctrl + F5C:\Program Files\Java\jdk-24.0.2
Or add to settings.json:
"java.home": "C:\\Program Files\\Java\\jdk-24.0.2"
// HelloWorld.java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello from CLI!");
}
}
// Terminal
javac HelloWorld.java
java HelloWorld
\bin — it shouldn't!%JAVA_HOME%\bin to Pathvscode-java-packWith OpenJDK 24.0.2 properly installed and your environment configured, you're ready to dive into Java development. Choose your favorite IDE, and you're set to write your first Java program — with no setup headaches.
Visit jdk.java.net or Adoptium for latest builds & options.
In our next post, we'll dive into 📘 [3] Java Syntax & Basics — Structure, Statements, and Starting Right!
— Blog by Aelify (ML2AI.com)
📚 Documentation Index