# Install Eclipse Temurin 17 JRE wget -O /tmp/temurin.deb https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.9%2B9/OpenJDK17U-jre_x64_linux_hotspot_17.0.9_9.deb sudo dpkg -i /tmp/temurin.deb For RPM-based systems, replace .deb with .rpm . After installation, verify:
source ~/.bashrc curl -s "https://get.sdkman.io" | bash sdk install java 17.0.9-tem sdk use java 17.0.9-tem 8. Setting JAVA_HOME Correctly Even if you only need the JRE, many applications check JAVA_HOME . Point it to the JRE installation directory.
Compile on a machine with JDK (or use online compiler), then run on target Linux with JRE:
dirname $(dirname $(readlink -f $(which java)))
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 export PATH=$JAVA_HOME/bin:$PATH Then reload:
which java # or readlink -f $(which java) Linux allows multiple JREs side-by-side. Use update-alternatives (Debian/Ubuntu) or manually set JAVA_HOME . Using update-alternatives (Debian/Ubuntu) # List available Java runtimes sudo update-alternatives --config java Manually register a new JRE sudo update-alternatives --install /usr/bin/java java /opt/jre-17/bin/java 1700 Manual JRE Switching (any distro) Set environment variables per user in ~/.bashrc or ~/.profile :
openjdk version "11.0.22" 2024-01-16 OpenJDK Runtime Environment (build 11.0.22+7-post-Ubuntu-0ubuntu222.04.1) OpenJDK 64-Bit Server VM (build 11.0.22+7-post-Ubuntu-0ubuntu222.04.1, mixed mode, sharing) To see the exact JRE path:
Jre Linux Link
# Install Eclipse Temurin 17 JRE wget -O /tmp/temurin.deb https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.9%2B9/OpenJDK17U-jre_x64_linux_hotspot_17.0.9_9.deb sudo dpkg -i /tmp/temurin.deb For RPM-based systems, replace .deb with .rpm . After installation, verify:
source ~/.bashrc curl -s "https://get.sdkman.io" | bash sdk install java 17.0.9-tem sdk use java 17.0.9-tem 8. Setting JAVA_HOME Correctly Even if you only need the JRE, many applications check JAVA_HOME . Point it to the JRE installation directory. jre linux
Compile on a machine with JDK (or use online compiler), then run on target Linux with JRE: # Install Eclipse Temurin 17 JRE wget -O /tmp/temurin
dirname $(dirname $(readlink -f $(which java))) Point it to the JRE installation directory
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 export PATH=$JAVA_HOME/bin:$PATH Then reload:
which java # or readlink -f $(which java) Linux allows multiple JREs side-by-side. Use update-alternatives (Debian/Ubuntu) or manually set JAVA_HOME . Using update-alternatives (Debian/Ubuntu) # List available Java runtimes sudo update-alternatives --config java Manually register a new JRE sudo update-alternatives --install /usr/bin/java java /opt/jre-17/bin/java 1700 Manual JRE Switching (any distro) Set environment variables per user in ~/.bashrc or ~/.profile :
openjdk version "11.0.22" 2024-01-16 OpenJDK Runtime Environment (build 11.0.22+7-post-Ubuntu-0ubuntu222.04.1) OpenJDK 64-Bit Server VM (build 11.0.22+7-post-Ubuntu-0ubuntu222.04.1, mixed mode, sharing) To see the exact JRE path: