• Home
  • Docker
  • Kubernetes
  • LLMs
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • Archived
Java | Install Java (Ubuntu)
  1. Install Java
  2. Manage multiple Java versions (update-alternatives)
    1. Check defaults
    2. Add a new java alternative to the system
    3. Configure java alternatives
    4. Set JAVA_HOME
  3. macOS

  1. Install Java
    Download the JDK/JRE: https://www.oracle.com/java/technologies/downloads/

    Extract the file "jdk-23_linux-x64_bin.tar.gz" in the folder you want to install Java: /opt/jdk-23.0.2

    Change the folder permissions:

    Setup the environment variables JAVA_HOME and PATH:
    • Open the file ".profile":
    • Append the following lines:
    • Reload the file ".profile":
    • Verify the environment variables:
    Locate the default java program file:
  2. Manage multiple Java versions (update-alternatives)
    1. Check defaults
      Note that these folders may not exist yet in your computer!


    2. Add a new java alternative to the system

    3. Configure java alternatives
    4. Set JAVA_HOME
  3. macOS
    • Check the current available JREs:

    • You might get an error similar to this one when you launch java commands:
      "jdk-13.0.1.jdk cannot be opened because the developer cannot be verified ..."
      To fix this issue, run the following command on the jdk package before extracting it:

    • You might get this error when you build your project with Maven:
      "No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?"

      You need to check the jre currently used: mvn -v
      Check if the jre is: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
      If it's the case, then you need to address that by one of the following solutions:
      Adjust the JAVA_HOME environment variable (as explained above):

      Or you can adjust the mvn shell command and set the JAVA_HOME:
© 2025  mtitek