Menú
08225, Terrassa (Barcelona)
Soporte Técnico
Sábados a convenir
Cita de admin en 21 febrero, 2022, 3:27 pm2.2. Installing a JRE on RHEL using an archive
You can install OpenJDK Java Runtime Environment (JRE) using an archive. This is useful if the Java administrator does not have root privileges.
NoteTo ease the upgrades for later versions create a parent directory to contain your JREs and create a symbolic link to the latest JRE using a generic path.
Procedure
- Download the latest version of the JRE archive for Linux.
Extract the contents of the archive to a directory of your choice:
$ mkdir ~/jres $ cd ~/jres $ java-17-openjdk-17.0.2.0.8-3.portable.jre.el.x86_64.tar.xzCreate a generic path by using symbolic links to your JRE for easier upgrades:
$ ln -s ~/jres/java-17-openjdk-17.0.2.0.8-3.portable.jre.el.x86_64 ~/jres/java-17Configure the
JAVA_HOME
environment variable:$ export JAVA_HOME=~/jres/java-17Verify that
JAVA_HOME
environment variable is set correctly:$ printenv | grep JAVA_HOME JAVA_HOME=~/jres/java-17NoteWhen installed using this method, Java will only be available for the current user.
Add the
bin
directory of the generic JRE path to thePATH
environment variable:$ export PATH="$JAVA_HOME/bin:$PATH"Verify that
java -version
works without supplying the full path:$ java -version openjdk version "17" 2021-10-19 OpenJDK Runtime Environment 21.9 (build 17+35) OpenJDK 64-Bit Server VM 21.9 (build 17+35, mixed mode, sharing)NoteYou can ensure that
JAVA_HOME
environment variable persists for the current user by exporting the environment variable in~/.bashrc
.
You can install OpenJDK Java Runtime Environment (JRE) using an archive. This is useful if the Java administrator does not have root privileges.
To ease the upgrades for later versions create a parent directory to contain your JREs and create a symbolic link to the latest JRE using a generic path.
Procedure
Extract the contents of the archive to a directory of your choice:
$ mkdir ~/jres $ cd ~/jres $ java-17-openjdk-17.0.2.0.8-3.portable.jre.el.x86_64.tar.xz
Create a generic path by using symbolic links to your JRE for easier upgrades:
$ ln -s ~/jres/java-17-openjdk-17.0.2.0.8-3.portable.jre.el.x86_64 ~/jres/java-17
Configure the JAVA_HOME
environment variable:
$ export JAVA_HOME=~/jres/java-17
Verify that JAVA_HOME
environment variable is set correctly:
$ printenv | grep JAVA_HOME JAVA_HOME=~/jres/java-17
When installed using this method, Java will only be available for the current user.
Add the bin
directory of the generic JRE path to the PATH
environment variable:
$ export PATH="$JAVA_HOME/bin:$PATH"
Verify that java -version
works without supplying the full path:
$ java -version openjdk version "17" 2021-10-19 OpenJDK Runtime Environment 21.9 (build 17+35) OpenJDK 64-Bit Server VM 21.9 (build 17+35, mixed mode, sharing)
You can ensure that JAVA_HOME
environment variable persists for the current user by exporting the environment variable in ~/.bashrc
.
© Informàtica Can Boada All rights reserved