Linux |link|: Jre
java -version Example output (OpenJDK 11):
A: Use server-class VM tuning: -Xmx256m -XX:+UseContainerSupport (for containers). Conclusion The JRE on Linux is a mature, lightweight runtime environment for executing Java applications. For most modern use cases, OpenJDK JRE (or Temurin/Corretto) is the recommended choice – freely available, secure, and well-integrated into all major distributions. Always keep it updated, manage multiple versions cleanly, and set JAVA_HOME correctly to avoid surprises. jre linux
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 : java -version Example output (OpenJDK 11): A: Use
For development or building code, install the instead. For running Java apps in production – especially headless servers – the JRE is exactly what you need. Always keep it updated, manage multiple versions cleanly,
Compile on a machine with JDK (or use online compiler), then run on target Linux with JRE:
// Hello.java public class Hello public static void main(String[] args) System.out.println("JRE works! Version: " + System.getProperty("java.version"));
dirname $(dirname $(readlink -f $(which java)))