To check the version of the Java compiler (javac
) on Ubuntu, follow these steps:
javac -version
This will display the version number of the javac
compiler.
Note: If you have multiple versions of Java installed on your system, the version of javac
that is used may not be the same as the version of the Java runtime (java
) that is currently set as the default. To change the default version of javac
, you can use the update-alternatives
command in a similar way as you would to change the default Java runtime. For example, to change the default javac
version to OpenJDK 8, you can run the following command:
sudo update-alternatives --config javac
This will list the available javac
versions and allow you to select the one you want to use as the default.