

First of all, run the following command to check the current Java version: $ java -version In this tutorial, I'll explain how to change the default Java version on a Linux machine. But the good thing is you can install multiple Java versions on your machine and quickly change the default JRE version. Now, if you run this program on a Linux machine where an unsupported Java version is installed, you will encounter an exception.įor example, if your program is compiled on Java 11, it can't be run on a machine where Java 8 is installed. When a Java program is compiled, the build environment sets the oldest JRE version the program can support. If you are a Java developer, it is normal to have multiple Java versions installed on your machine to support different build environments.
