Hello,dwx 0
Welcome to posting in the Microsoft Community.
This problem usually occurs when there is an incomplete and clean uninstallation on the system, especially when a previously installed version of Java has not been removed correctly, resulting in registry leftovers, misconfigured environment variables, or conflicting system files that affect the operation of the newly installed program. Please try the following steps to narrow down the problem:
Ⅰ. Cleaning Up Older Versions of Java
1 Download and run the Java Uninstall Tool, which scans your system for all installed versions of Java and cleans up residual files and registry entries.
- Clean up the residual files manually by deleting all Java files in the following directory: C:\Program Files\Java C:\Program Files (x86)\Java %APPDATA%\Sun\Java %USERPROFILE%.java
- Clean the registry manually:
Disclaimer: Generally, modifying registry subkeys or work group is intended for advanced users, administrators, and IT Professionals. It can help fix some problems, however, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For further protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click How to back up and restore the registry in Windows - Microsoft Support to view the article.
Ⅱ. Check and fix the environment variables
1 Press Win + R and type sysdm.cpl to open System Properties.
- Go to Advanced > Environment Variables and do the following:
- Check if the JAVA_HOME variable exists, if it exists and the path is wrong, please delete or modify it to the correct path.
- Find Java-related paths in Path (e.g. C:\Program Files\Java\jdk...) and delete any invalid paths. Delete all invalid paths.
III. Checking system permissions and compatibility
- Ensure that you are running the installer as an administrator. Right-click on the Java installer and select “Run as administrator”.
- Try compatibility mode. Right-click the installer, select “Properties > Compatibility”, check “Run this program in compatibility mode”, and select your operating system version (e.g. Windows 10).
- Disable security software. Some antivirus programs may prevent the installer from running, try temporarily disabling your antivirus or firewall.
Disclaimer: Temporarily turn off antivirus protection. However, keep in mind that if you do so, your device may be vulnerable to threats. So please turn it on immediately once issue fixed.
Ⅳ. Repairing Windows System Files
- Search for CMD, find the command prompt, and choose to run in administrator mode.
- Enter the following commands one by one, please make sure to execute the next command after the previous one is completed. DISM /Online /Cleanup-Image /ScanHealth DISM /Online /Cleanup-Image /CheckHealth DISM /Online /Cleanup-Image /RestoreHealth SFC /Scannow
- After the scan is complete, you can check the scanning information to see if the problem has been detected and fixed.
V. Contact Java Installer technical support to check log files
If the problem persists, you may need to contact official technical support for a customized solution. the Java Installer usually generates log files, which can be viewed for additional error information.
I would be happy to assist you in investigating this issue and you can share some information with me and I will answer it for you further. Thank you for your understanding and cooperation!
Best Regards,
Rota|Microsoft Community Support Specialist