Is it possible to find all the supported backward compatible Java versions supported by currently installed JDK through command line?
I was going through command line options, but I couldn't find any option which seems to be providing this information.
This requirement came because there are two different machines where an application need to be run. In one machine the JDK 11 is installed where JAXB is not supported, where as in another machine JDK 8 is installed which supports JAXB.
Update: Based on response "whatever it means", I would like to expand what is being expected:
$ java <command_line_option>
JDK11, JDK10, JDK9, JDK8
Generally speaking, new Java versions are compatible with old ones but with some caveats, so that hypothetical command-line option should list all previous versions (or none!); however I confirm what you have already seen: that command line option does not exist.
Instead of searching for a "backward compatible Java version", just adapt the application to work both with Java 8 and Java 11: it does not require much time and it will probably work with Java 17 and Java 21 too.
Java 11 can run code compiled with Java 8 but, as you already know, some libraries have been removed from the JDK; so, to run a Java 8 application on Java 11 too, the first thing to do is to add the missing libraries to its classpath. If you have a fat jar you can add these libraries in the fat jar (they are harmless if you run on Java 8). Another thing that could be necessary is opening some modules, for example with this command line option:
--add-opens java.base/java.lang=ALL-UNNAMED.