I have Java installed. I ran Optifine (which also requires Java) and I ran the Forge installer through opening cmd. Minecraft Java Edition installs Java automatically for you.
And I don't know how to update Java when it isn't installed separately on my computer. I will be very grateful if someone can help me.
Thanks in advance!