Compile on a machine with JDK (or use online compiler), then run on target Linux with JRE:
For development or building code, install the instead. For running Java apps in production – especially headless servers – the JRE is exactly what you need. jre linux
java -version Example output (OpenJDK 11): Compile on a machine with JDK (or use