How to fix (Error: LinkageError occurred while loading main class test java.lang.UnsupportedClassVersionError: test has been compiled by a more recent version of the Java Runtime (class file version 63.0), this version of the Java Runtime only recognizes class file versions up to 55.0)

While trying to compile and run the java program i got : Error: LinkageError occurred while loading main class test java.lang.UnsupportedClassVersionError: test has been compiled by a more recent version of the Java Runtime (class file version 63.0), this version of the Java Runtime only recognizes class file versions up to 55 . 0 To resolve the error i did: sudo update-alternatives --config java and chose the manual method(2). Worked like charm for me.