Videos
Remove Java 8 completely because its installation seems to be broken. Check https://java.com/ for help, it contains an uninstall tool.
Take Open JDK 18 from https://jdk.java.net/18/. It is available as zip file (https://download.java.net/java/GA/jdk18.0.1.1/65ae32619e2f40f3a9af3af1851d6e19/2/GPL/openjdk-18.0.1.1_windows-x64_bin.zip).
Unzip it into a folder and use it from command line or an IDE.
P.S.: It is preferable to take version 17 as it is a longterm supported version.
You have not explained what installer you used, nor where you obtained it. So we cannot diagnose your problem.
Reviewing your logs may provide details about the failure of your installer.
I suggest you get a fresh installer from any of the several vendors. These include, in no particular order: Amazon, Adoptium, SAP, Azul Systems, Microsoft, Red Hat/IBM, Oracle, BellSoft, Pivotal, and more. Be sure to read their licensing terms; some are free-of-cost, some are not.
- Be sure to get an installer appropriate to your host OS, Microsoft Windows apparently in your case. Be sure the version of your host OS is supported.
- Be sure to use an installer appropriate to the CPU architecture of your host computer. For Windows that will be either 32-bit or 64-bit generations of either x86 or ARM.
So you have three factors to get right in choosing to download a JDK:
Host OS > x86 or ARM > 32-bit or 64-bit.
I am guessing you got one of those factors wrong in your previous attempt.
As for the other Answer that suggests deleting Java 8, I cannot imagine how that would be of help to you. You should be able to have multiple versions of Java installed on the same machine. Having multiple versions is very common among developers and testers.