I've been working on setting up Visual Studio for .NET MAUI development on my Windows computer, but I keep running into a problem during the setup process. The specific issue involves OpenJDK v8 failing to install. This is what I'm seeing:
Couldn't install OpenJDKv8
I've given a few things a shot to move past this, but nothing has worked yet. Here's a quick list of what I've already tried:
This is the full error message I got during the installation:
Package 'OpenJDKv8,version=8.0.302.8,chip=x64' failed to install.
Return code: -2147024891
Return code details: Access to the path 'C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08\bin\klist.exe' is denied.
Install Error:
Something went wrong with the install.
You can troubleshoot the package failures by:
1. Search for solutions using the search URL below for each package failure
2. Modify your selections for the affected workloads or components and then retry the installation
3. Remove the product from your machine and then install again
If the issue has already been reported on the Developer Community, you can find solutions or workarounds there. If the issue has not been reported, we encourage you to create a new issue so that other developers will be able to find solutions or workarounds. You can create a new issue from within the Visual Studio Installer in the upper-right hand corner using the "Provide feedback" button.
================================================================================
Package 'OpenJDKv8,version=8.0.302.8,chip=x64' failed to install.
Search URL
https://aka.ms/VSSetupErrorReports?q=PackageId=OpenJDKv8;PackageAction=Install;ReturnCode=-2147024891
Details
Return code: -2147024891
Return code details: Access to the path 'C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08\bin\klist.exe' is denied.
Log
C:\Users\User\AppData\Local\Temp\dd_setup_20240904132622_002_OpenJDKv8.log
Impacted workloads
.NET Multi-platform App UI development (Microsoft.VisualStudio.Workload.NetCrossPlat,version=17.11.35102.94)
Impacted components
.NET MAUI (Microsoft.VisualStudio.ComponentGroup.Maui.All,version=17.11.35102.94)
.NET MAUI development tools (Microsoft.VisualStudio.ComponentGroup.Maui.Shared,version=17.11.35102.94)
.NET MAUI for Android (Microsoft.VisualStudio.ComponentGroup.Maui.Android,version=17.11.35102.94)
OpenJDK (Microsoft distribution) (Component.OpenJDK,version=17.11.35102.94)
Relevant Log Snippets:
[4100:0009][2024-09-04T13:26:36] Started: Extracting C:\ProgramData\Microsoft\VisualStudio\Packages\OpenJDKv8,version=8.0.302.8,chip=x64\OpenJDK8U-jdk_x64_windows_hotspot_8u302b08.zip to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot
[4100:0009][2024-09-04T13:26:36] Started: Copying file jdk8u302-b08/ASSEMBLY_EXCEPTION to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/ASSEMBLY_EXCEPTION
[4100:0009][2024-09-04T13:26:36] Completed: Copying file jdk8u302-b08/ASSEMBLY_EXCEPTION to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/ASSEMBLY_EXCEPTION
[4100:0009][2024-09-04T13:26:36] Timestamp updated for file 'C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/ASSEMBLY_EXCEPTION'.
[4100:0009][2024-09-04T13:26:36] Started: Copying file jdk8u302-b08/bin/jrunscript.exe to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/jrunscript.exe
[4100:0009][2024-09-04T13:26:36] Completed: Copying file jdk8u302-b08/bin/jrunscript.exe to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/jrunscript.exe
[4100:0009][2024-09-04T13:26:36] Timestamp updated for file 'C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/jrunscript.exe'.
[4100:0009][2024-09-04T13:26:36] Started: Copying file jdk8u302-b08/bin/jsadebugd.exe to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/jsadebugd.exe
[4100:0009][2024-09-04T13:26:36] Completed: Copying file jdk8u302-b08/bin/jsadebugd.exe to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/jsadebugd.exe
[4100:0009][2024-09-04T13:26:36] Timestamp updated for file 'C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/jsadebugd.exe'.
[4100:0009][2024-09-04T13:26:36] Started: Copying file jdk8u302-b08/bin/jstat.exe to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/jstat.exe
[4100:0009][2024-09-04T13:26:36] Completed: Copying file jdk8u302-b08/bin/jstat.exe to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/jstat.exe
[4100:0009][2024-09-04T13:26:36] Timestamp updated for file 'C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/jstat.exe'.
[4100:0009][2024-09-04T13:26:36] Started: Copying file jdk8u302-b08/bin/jstatd.exe to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/jstatd.exe
[4100:0009][2024-09-04T13:26:36] Completed: Copying file jdk8u302-b08/bin/jstatd.exe to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/jstatd.exe
[4100:0009][2024-09-04T13:26:36] Timestamp updated for file 'C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/jstatd.exe'.
[4100:0009][2024-09-04T13:26:36] Started: Copying file jdk8u302-b08/bin/keytool.exe to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/keytool.exe
[4100:0009][2024-09-04T13:26:36] Completed: Copying file jdk8u302-b08/bin/keytool.exe to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/keytool.exe
[4100:0009][2024-09-04T13:26:36] Timestamp updated for file 'C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/keytool.exe'.
[4100:0009][2024-09-04T13:26:36] Started: Copying file jdk8u302-b08/bin/kinit.exe to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/kinit.exe
[4100:0009][2024-09-04T13:26:36] Completed: Copying file jdk8u302-b08/bin/kinit.exe to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/kinit.exe
[4100:0009][2024-09-04T13:26:36] Timestamp updated for file 'C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/kinit.exe'.
[4100:0009][2024-09-04T13:26:36] Started: Copying file jdk8u302-b08/bin/klist.exe to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/klist.exe
[4100:0009][2024-09-04T13:26:36] Completed: Copying file jdk8u302-b08/bin/klist.exe to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/klist.exe
[4100:0009][2024-09-04T13:26:36] Timestamp updated for file 'C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08/bin/klist.exe'.
[4100:0009][2024-09-04T13:26:36] Completed: Extracting C:\ProgramData\Microsoft\VisualStudio\Packages\OpenJDKv8,version=8.0.302.8,chip=x64\OpenJDK8U-jdk_x64_windows_hotspot_8u302b08.zip to C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot
System Information:
Has anyone ever experienced this? I wonder if there is a way to bypass the OpenJDK installation entirely through Visual Studio and just set it up manually for Android development in the MAUI. Or am I missing something simple?
Upon digging deeper, I found out that Microsoft Defender Antivirus was behind the problem. In particular, the latest Windows update seemed to have removed the exclusion for C:\Program Files from the Microsoft Defender settings. This resulted in Microsoft Defender stopping access to the folder where OpenJDK was supposed to install leading to the "Access Denied" error during installation.
Solution:
I fixed the issue by adding C:\Program Files back to the exclusions in Microsoft Defender Antivirus .
Here's what I did :