sudo apk add openjdk11-jre
| Issue | Solution | |-------|----------| | java: command not found | JRE not installed or not in PATH. Reinstall or fix $PATH . | | Error: Could not find or load main class | Wrong class name (case-sensitive) or missing classpath. Use java -cp . ClassName . | | Unsupported major.minor version | JRE older than compiled class version. Install newer JRE. | | JAVA_HOME should point to a JDK not a JRE | For build tools (Maven, Gradle). Either install JDK or set JAVA_HOME to JDK path. | | java.net.ConnectException: Connection refused | Network/firewall issue, not JRE fault. Check iptables / firewalld . | jre linux
For development or building code, install the instead. For running Java apps in production – especially headless servers – the JRE is exactly what you need. sudo apk add openjdk11-jre | Issue | Solution
# Debian/Ubuntu apt list --upgradable | grep openjdk Use java -cp
Example output (OpenJDK 11):