You can install Minecraft Forge for free from the Forge website, and then use it to download and enable mods.
Then, select “Open With” and “Java”. if you don’t have Java or the Java file doesn’t work, you will need to download Java 21. This is required for Minecraft 1.21.4 mods like OptiFine.
To install Java on Windows and run Java apps on Microsoft’s operating system, you need to obtain a copy of the Java Development Toolkit (JDK) installation media. The JDK includes both a Java Runtime ...