How To Install Oracle Java (JDK) On Ubuntu 24.04 LTS, Debian Linux (2024)

Sdílet
Vložit
  • čas přidán 20. 05. 2024
  • How to Install Oracle Java (JDK) on Ubuntu 24.04 LTS / Debian Linux | Step-by-Step Guide | Setting JAVA_HOME
    How To Install Oracle Java (JDK) On Ubuntu, Debian Linux - • How To Install Oracle ...
    Installing Oracle Java Development Kit (JDK) on Ubuntu 24.04 LTS or Debian Linux can be essential for developers needing the latest Java features and performance enhancements. This guide will walk you through the process of downloading and installing Oracle JDK on your system. Follow these steps to get Java up and running.
    *Step-by-Step Instructions:*
    **Step 1: Download Oracle JDK **
    1. Open your web browser and navigate to the [Oracle JDK Downloads page](www.oracle.com/java/technolog....
    2. Find the section for JDK and select the appropriate package for your system (Linux x64 .deb file).
    3. Accept the Oracle license agreement and download the .deb file to your computer.
    *Step 2: Open Terminal*
    1. Press `Ctrl + Alt + T` or search for "Terminal" in the Applications menu to open a terminal window.
    *Step 3: Install Dependencies*
    1. Before installing the JDK, ensure that your package list is up to date by running:
    ```bash
    sudo apt update
    ```
    **Step 4: Install JDK **
    1. Navigate to the directory where you downloaded the .deb file. For example, if the file is in your Downloads folder, use:
    ```bash
    cd ~/Downloads
    ```
    2. Install the .deb package using the `dpkg` command:
    ```bash
    sudo dpkg -i jdk-22_linux-x64_bin.deb
    ```
    3. If you encounter any dependency issues, resolve them by running:
    ```bash
    sudo apt-get install -f
    ```
    *Step 5: Verify the Installation*
    1. To ensure that the JDK was installed correctly, check the Java version:
    ```bash
    java -version
    ```
    You should see output indicating that Java 22 is installed.
    2. Additionally, you can check the JDK installation path:
    ```bash
    which java
    ```
    *Step 6: Set Up JAVA_HOME Environment Variable*
    1. Setting the JAVA_HOME environment variable is crucial for many development tools. Open your `.bashrc` file in a text editor:
    ```bash
    nano ~/.bashrc
    ```
    2. Add the following lines at the end of the file, replacing the path with the actual path where JDK is installed:
    ```bash
    export JAVA_HOME=/usr/lib/jvm/jdk-22
    export PATH=$PATH:$JAVA_HOME/bin
    ```
    3. Save the file and exit the text editor (in Nano, press `Ctrl + X`, then `Y`, and `Enter`).
    4. Apply the changes by sourcing the `.bashrc` file:
    ```bash
    source ~/.bashrc
    ```
    *Step 7: Verify JAVA_HOME*
    1. To confirm that the JAVA_HOME environment variable is set correctly, run:
    ```bash
    echo $JAVA_HOME
    ```
    This should output the path to your JDK installation.
    *Additional Tips:*
    - **Updating JDK**: When a new version of JDK is released, you can download and install the new .deb package following the same steps.
    - **Switching Between Java Versions**: If you need to manage multiple Java versions, consider using `update-alternatives`:
    ```bash
    sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-22/bin/java 1
    sudo update-alternatives --config java
    ```
    By following these steps, you can successfully install Oracle JDK on your Ubuntu 24.04 LTS or Debian Linux system, enabling you to leverage the latest Java features for your development projects.
    Don't forget to like, share, and subscribe for more tech tutorials and tips!
    #OracleJDK #Java22 #Ubuntu #Debian #Linux #Ubuntu2404LTS #TechTutorial #HowTo #JavaDevelopment #OpenSource #TechTips #Tutorial
    #JavaInstallation #OracleJDK #Ubuntu2204LTS #DebianLinux #JavaDevelopment #JavaProgramming #LinuxTutorials #StepByStepGuide
    JavaJDK#Javatutorialforbeginners #Javatutorial #Javaprogramming #Javaprogrammingtutorial #Javabasicsforbeginners #Ubuntu #Debian #Linux

Komentáře • 9

  • @gabrielmalheiro4871
    @gabrielmalheiro4871 Před 9 dny

    Thanks a lot bro! You really helped me! I've just installed ubuntu 24.04 and needed to set my Java variables! Tks a lot

  • @quesomagro6954
    @quesomagro6954 Před 3 hodinami

    Very rich content!! I suscribe to ur channel dude!

  • @Hassam-deno
    @Hassam-deno Před 4 dny

    It worked.

  • @cbbcbb6803
    @cbbcbb6803 Před měsícem

    Thanks.

  • @luizkevin11
    @luizkevin11 Před měsícem

    Thanks bro

  • @Riteshraaz205
    @Riteshraaz205 Před 9 dny

    Bhai in Ubuntu I can't set up in C language Vs Code and can't run it so u can help me bro 😢

  • @middleclass1256
    @middleclass1256 Před 14 hodinami

    ❤❤❤❤❤thanks🌹🌹🌹🌹🌹

  • @notoriousgaming5249
    @notoriousgaming5249 Před měsícem

    could not open `/usr/lib/jvm/jdk-22-oracle-x64/lib/jvm.cfg'
    Plz solve this error sir