Interactive tutorial

Install the JDK and Write Your First Java Program

Install the Java Development Kit, verify your Java tools, and write your first Java program using a plain-text editor and terminal. You will compile and run the program on your own computer, change its output, and troubleshoot common beginner errors. Installation paths cover Windows 11, macOS, and Ubuntu 24.04 LTS.

  • Level: Beginner
  • Duration: approx. 39 min
  • 9 steps
Install the JDK and Write Your First Java Program

What you will go through

  1. Step 1 of 9 2 min Understand the Tools and the Goal Learn the tools and conceptual workflow behind writing and running a first local Java program.
  2. Step 2 of 9 9 min Choose and Install JDK 21 Select and install the supported JDK 21 package for your operating system and processor architecture before verifying the Java tools.
  3. Step 3 of 9 5 min Verify Java in the Terminal Verify that your terminal can locate both Java development tools and that they are using JDK 21.
  4. Step 4 of 9 4 min Create and Save the Source File Create one local Java project folder and save the starter source file as plain text.
  5. Step 5 of 9 3 min Read Your First Java Program Read the structure of `HelloJava.java`, distinguish required Java syntax from the editable message, and complete a valid first program.
  6. Step 6 of 9 4 min Compile and Run the Program Compile your saved Java source file into bytecode, then run the resulting class from the terminal.
  7. Step 7 of 9 3 min Change the Output and Run Again Add a second output line, rebuild the class file, and recognize why a saved source change is not visible until compilation succeeds.
  8. Step 8 of 9 4 min Fix Common Beginner Errors Use workflow stages and diagnostic clues to correct common Java beginner errors without accidentally relying on an older class file.
  9. Step 9 of 9 5 min Complete Your First Java Workflow Assemble the final two-line program, compile and run it locally, and explain how the source file, bytecode, compiler, and launcher work together.

Video Courses

Courses related to this topic

See all video courses

Download the App now to have access to + 5000 free courses, exercises, certificates and lots of content without paying anything!

  • 100% free online courses from start to finish

    Thousands of online courses in video, ebooks and audiobooks.

  • More than 60 thousand free exercises

    To test your knowledge during online courses

  • Valid free Digital Certificate with QR Code

    Generated directly from your cell phone's photo gallery and sent to your email

Cursa app on the ebook screen, the video course screen and the course exercises screen, plus the course completion certificate