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

Поделиться
HTML-код
  • Опубликовано: 20 май 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

Комментарии • 7

  • @gabrielmalheiro4871
    @gabrielmalheiro4871 5 дней назад

    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

  • @Hassam-deno
    @Hassam-deno 5 часов назад

    It worked.

  • @luizkevin11
    @luizkevin11 27 дней назад

    Thanks bro

  • @Riteshraaz205
    @Riteshraaz205 5 дней назад

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

  • @cbbcbb6803
    @cbbcbb6803 Месяц назад

    Thanks.

  • @notoriousgaming5249
    @notoriousgaming5249 Месяц назад

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