The following error message in Console may illustrate a need to switch Java version:

Exception in thread "main" java.lang.IllegalAccessError: class cpw.mods.modlauncher.SecureJarHandler (in unnamed module @0x2a79781f) cannot access class (in module java.base) because module java.base does not export to unnamed module @0x2a79781f

You can easily change it by accessing your Minecraft Instance, clicking on Manage:

Selecting Configuration:

And specifying the needed version in the Java and Memory section:

You can choose between various Java versions in case Minecraft plugin or server JAR requires a special environment 😊

Did this answer your question?