Question Java won't reinstall due to 'not being able to create a virtual machine'

Mar 30, 2019
2
0
10
Whenever I try to reinstall java, the install is around 80% done when the error message "Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.", and this happens on all the versions of java I attempted to download, and it occurs on both 32 and 64 bit. I had tried deleting all the java folders and restarting my system, and reinstalling from there, but it doesn't work. Java isn't showing up in the Programs and Features either, as it is not fully installed, but may be partially installed and is creating errors. I have also tried the offline installer, but it just does the same thing.
 
Mar 30, 2019
2
0
10
What you system os? spec?
I'm on windows 10, 64 bit,
Cpu: Intel Core i5-7400 CPU @3.00GHz
Gpu: Nvidia GeForce GTX 1050
Motherboard: ASUSTek of unknown model
and 8gb of ram

And another thing to add is that when I put 'java -version' into the command prompt it says
'Error: opening registry key 'Software\JavaSoft\Java Runtime Environment'
Error: Could not find java.dll
Error: Could not find Java SE Runtime Environment'