Learn Loner

Course Content
Java Programming Language
About Lesson

  1. Download Java Development Kit (JDK):

  2. Run the Installer:

    • For Windows: Double-click the downloaded installer file and follow the on-screen instructions.
    • For macOS: Open the downloaded .dmg file and run the installer package, then follow the instructions.
    • For Linux: Open a terminal and navigate to the directory where the downloaded .tar.gz file is located. Extract the archive using the following command:
      tar -xvf <jdk-archive-filename.tar.gz>

      Replace <jdk-archive-filename.tar.gz> with the actual name of the downloaded JDK file. Once extracted, you can move the JDK folder to a desired location.

  3. Set up Environment Variables:

    • For Windows:
      • Open the System Properties by right-clicking on the “This PC” or “My Computer” icon, selecting “Properties,” and then clicking on “Advanced system settings.”
      • Click on the “Environment Variables” button.
      • In the “System Variables” section, click “New” and set the following variables:
        • Variable name: JAVA_HOME
        • Variable value: The path to the JDK installation directory (e.g., C:Program FilesJavajdk1.8.0_301).
      • In the same “System Variables” section, locate the Path variable, select it, and click “Edit.”
      • Append the following value to the Path variable:
        %JAVA_HOME%bin
    • For macOS and Linux:
      • Open a terminal and enter the following command:
        nano ~/.bash_profile

        This will open the .bash_profile file in the nano text editor.

      • Add the following line at the end of the file:
        export JAVA_HOME=/path/to/jdk

        Replace /path/to/jdk with the actual path to the JDK installation directory.

      • Save the file (Ctrl + X, Y, Enter) and close the terminal.
  4. Verify the Installation:

    • Open a new terminal or command prompt window.
    • Type the following command and press Enter:
      java -version
    • If the installation was successful, you should see the installed JDK version information displayed in the terminal.

Java is now installed and ready to use on your system. You can start writing and running Java programs using a text editor or an Integrated Development Environment (IDE) such as Eclipse, IntelliJ IDEA, or NetBeans.

Join the conversation
Shopping Basket