Questo contenuto non è disponibile nella lingua selezionata.

Chapter 3. Selecting an installed Red Hat build of OpenJDK version for a specific application


Some applications require a specific Red Hat build of OpenJDK version to run. If multiple versions of Red Hat build of OpenJDK are installed on the system using the yum package manager or portable bundle, you can select a Red Hat build of OpenJDK version for each application where necessary by setting the value of the JAVA_HOME environment variable or using a wrapper script.

Prerequisites

  • Multiple versions of Red Hat build of OpenJDK installed on the machine.
  • Ensure that the application you want to run is installed.

Procedure

  1. Set the JAVA_HOME environment variable. For example, if Red Hat build of OpenJDK 21 was installed using yum:

    $ JAVA_HOME=/usr/lib/jvm/java-17-openjdk

    Note

    The symbolic link java-17-openjdk is controlled by the alternatives command.

  2. Do one of the following:

    • Launch the application using the default, system-wide configuration.

      $ mvn --version
      Apache Maven 3.5.4 (Red Hat 3.5.4-5)
      Maven home: /usr/share/maven
      Java version: 11.0.9, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.el8_0.x86_644/jre
      Default locale: en_US, platform encoding: UTF-8
      OS name: "linux", version: "4.18.0-144.el8.x86_64", arch: "amd64", family: "unix"
    • Launch the application specifying the JAVA_HOME variable:

      $ JAVA_HOME=/usr/lib/jvm/java-17-openjdk-17.0.0.0.35-4.el8.x86_64/ mvn --version
      
      Apache Maven 3.5.4 (Red Hat 3.5.4-5)
      Maven home: /usr/share/maven
      Java version: 17, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-17-openjdk-17.0.0.0.35-4.el8.x86_64
      Default locale: en_US, platform encoding: UTF-8
      OS name: "linux", version: "4.18.0-305.19.1.el8_4.x86_64", arch: "amd64", family: "unix"
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2026 Red Hat
Torna in cima