The problem
Each Minecraft version needs a specific Java. Use the wrong one and the server won't start, usually with an error like UnsupportedClassVersionError.
What Cubi does
Cubi reads the Minecraft version of your server and downloads the right Java(8, 17, 21 or 25) into its own folder. It's used only for your servers and doesn't touch any Java you have installed.
Each server gets its own runtime, so an old 1.12 modpack and the latest version can live side by side.
Nothing to configure. Create a server and press Start.