The Web installer for Java tends to be a little bit buggy.
After doing so, use the Microsoft uninstaller to clean up any Java fragments. In these situations, you should use the Windows Control Panel to remove any instances of Java. If the Java Control Panel is missing, the problem is often related to a conflict with JavaFX or legacy Java code. If the installation appears to succeed, but Java is not working, check to see whether the Java Control Panel exists within the Windows Control Panel. The easiest way to do this is to go to this special test page, which will tell you conclusively whether Java is working.
Therefore, I recommend beginning the troubleshooting process by verifying that Java really isn't working.
I have seen a couple of situations in which an installation error was displayed even though Java installed correctly.