I'm currently in the process of downloading Java and Optifine for Minecraft, but whenever I download Optifine, it is as a text document on my PC and not as a Java file. I've already tried out a lot of what is on YouTube and so on, but it didn't help.
If you have Java installed, try right-clicking> Open with…> Java. If Java can't be found there, click on Select another app and navigate to the path where Java is installed and select javaw.exe there.
Do you have jarfix?
Is it actually a .txt file or does it only open with a text program?
It's a .txt file and when I open it there are only strange characters.
I tried it, but it didn't work.
Are you sure you are downloading the correct file? https://optifine.net/.../downloads is the right link (download from Mirror). If the problem persists, just turn the .txt into a .jar should then work.