Extesion fails to start in Visual Studio 2022 (could not find java.dll)

Extension fails to start right after getting installed.

  • Microsoft Windows [Version 10.0.19045.5608]

  • Microsoft Visual Studio Professional 2022 (64-bit) Version 17.12.5

  • No Java installed

  • Using SonarQube server

Log from Output window:

[ThreadId 1] Initializing the telemetry package...
[ThreadId 1] Finished initializing the telemetry package...
[ThreadId 55] Initializing the daemon package...
[ThreadId 55] [Connection Migration] Start migrating connections from existing bindings
[ThreadId 55] [Connection Migration] End migrating connections from existing bindings
[ThreadId 1] Current VS version:
    Visual Studio Professional 2022
    17.12.35728.132
    17.12.5
[DEBUG] [ThreadId 1] [ConnectedMode/GitMonitor] No repo detected - nothing to monitor
[ThreadId 6] [SLCoreHandler] Creating SLCore instance
[ThreadId 6] [SLCoreHandler] Starting SLCore instance
[ThreadId 15] [SLCORE-ERR] Error: could not find java.dll
[ThreadId 15] [SLCORE-ERR] Error: Could not find Java SE Runtime Environment.
[ThreadId 6] Loaded settings from "C:\Users\MārisCakuls\AppData\Roaming\SonarLint for Visual Studio\settings.json".
[ThreadId 6] [NodeJSLocator] Checking environment variable SONAR_NODEJS_PATH
[ThreadId 6] [NodeJsLocator] Environment variable is not set
[ThreadId 6] [SLCoreHandler] SLCore instance exited
[ThreadId 6] [SLCoreHandler] Creating SLCore instance
[ThreadId 6] [SLCoreHandler] Starting SLCore instance
[ThreadId 6] [NodeJSLocator] Checking environment variable SONAR_NODEJS_PATH
[ThreadId 6] [NodeJsLocator] Environment variable is not set
[ThreadId 10] [SLCORE-ERR] Error: could not find java.dll
[ThreadId 10] [SLCORE-ERR] Error: Could not find Java SE Runtime Environment.
[ThreadId 6] [SLCoreHandler] SLCore instance exited
[DEBUG] [ThreadId 6] [Notifications] Disabled notifications file does not exist. File: C:\Users\Å ausmas\AppData\Roaming\SonarLint for Visual Studio\17\internal.notifications.json
[ThreadId 1] [Notifications] Failed to display notification "sonarlint.sloop.restart.failed": System.NullReferenceException: Object reference not set to an instance of an object.
   at SonarLint.VisualStudio.Core.Notifications.NotificationService.ShowInfoBar(INotification notification, Guid toolWindowId)
[ThreadId 6] Finished initializing the daemon package.
[DEBUG] [ThreadId 1] [ConnectedMode/GitMonitor] Monitoring git repo. Root path: C:\local-repo
[ThreadId 65] [ConnectedMode/DotnetAnalyzerIndicator] Service Provider is unavailable
[DEBUG] [ThreadId 27] SLCore service is not available, telemetry is discarded
[ThreadId 48] [SLCore > Workspace Files > Tracking] Service Provider is unavailable
[ThreadId 66] [SLCoreAnalyzer] Analyzing C:\local-repo\SomeProject\Program - Select Weather.cs with id e9536fe4-69b1-4ba9-9f2f-18205006bbdf
[ThreadId 66] [SLCoreAnalyzer] Analysis e0036fe4-69b1-4ba9-9f2f-18205006aadf not ready for file C:\local-repo\SomeProject\Program - Select Weather.cs: Configuration scope not initialized
[ThreadId 1] Initializing the SonarQube for Visual Studio package...
[ThreadId 1] Finishing initializing the SonarQube for Visual Studio package
[ThreadId 86] Initializing the notifications package...
[ThreadId 1] Not connected: not checking for notifications
[ThreadId 1] Finished initializing the notifications package
[ThreadId 1] [Shared Binding] The shared binding configuration file was not found and will not be used. Probed path: not found

Hi,

Welcome to the community and thanks for this report!

What version of SonarQube for Visual Studio are you using?

 
Thx,
Ann

Hi,

I am using SonarQube for VisualStudio 2022 8.13.0.12427

Hi,

Thanks for that detail. I’ve flagged this for the team.

 
Ann

Hi @padzeralu,

Thanks for reporting this issue! Since Java is embedded in the extension, the error ā€œError: could not find java.dllā€ could indicate a problem with the installation or that some files were blocked by security software.

I would suggest you to reinstall the extension and at the same time try checking your firewall or antivirus if they flagged and blocked the extension or any of its files.

:one: Reinstall the Extension

  • Uninstall the extension completely.
  • Restart Visual Studio.
  • Reinstall the latest version of the extension to ensure all files are properly installed.

:two: Check for Security Software Blocking

  • Your firewall or antivirus might have flagged and blocked the embedded Java files.
  • Try checking your antivirus/firewall after reinstalling the extension.
  • In that case you could add an exception for the extension in your security software.

If the issue persists, please let us know!

:three: Workaround: Manually specify a Java Installation

  • Another possible but less ideal solution would be to install java on your machine and let the extension use that installation.
  • To specify a JRE, go to Extensions > SonarQube for Visual Studio > Options… > SonarQube for Visual Studio > General > Java Home , add the path to your JRE, and restart your IDE to apply the setting.

Kind regards,
Vasileios Naskos

1 Like

After installing the recent update for both VS2022 and SQ extension the error output log looks slightly better but still unable to connect to server.

[ThreadId 1] [Connected Mode > Shared Binding] The shared binding configuration file was not found and will not be used. Probed path: not found
[DEBUG] [ThreadId 167] [SlCoreConnectionAdapter] [IConnectionConfigurationSLCoreService] Service Provider is unavailable
[DEBUG] [ThreadId 144] [SlCoreConnectionAdapter] [IConnectionConfigurationSLCoreService] Service Provider is unavailable
[DEBUG] [ThreadId 164] [SlCoreConnectionAdapter] [IConnectionConfigurationSLCoreService] Service Provider is unavailable
[DEBUG] [ThreadId 150] [SlCoreConnectionAdapter] [IConnectionConfigurationSLCoreService] Service Provider is unavailable

Thanks for the update, it’s good to hear that we’re in a better state!

It looks like there’s still some work to do to fully understand and resolve the issue. To dig deeper, could you please share the full Verbose logs?

I appreciate your patience and understanding as we work through this! :grin:

Hi,

I switched on Verbos logs and also updated Visual Studio again, but that didn’t help much so I just went ahead and installed JDK and specified the path in options.

This is the version I am using is
https://download.java.net/java/GA/jdk23.0.2/6da2a6609d6e406f85c491fcb119101b/7/GPL/openjdk-23.0.2_windows-x64_bin.zip

However, the extension is still failing to connect to server.

[ThreadId 1] Initializing the telemetry package…
[ThreadId 1] Finished initializing the telemetry package…
[ThreadId 63] Initializing the daemon package…
[ThreadId 63] [Connection Migration] Start migrating connections from existing bindings
[ThreadId 63] [Connection Migration] End migrating connections from existing bindings
[DEBUG] [ThreadId 1] [ConnectedMode/GitMonitor] No repo detected - nothing to monitor
[ThreadId 1] Current VS version:
Visual Studio Professional 2022
17.13.35919.96
17.13.5
[ThreadId 11] [SLCoreHandler] Creating SLCore instance
[ThreadId 11] [SLCoreHandler] Starting SLCore instance
[DEBUG] [ThreadId 11] Using JRE location provided in the settings ā€œC:\jdk\openjdk-23.0.2_windows-x64_bin\jdk-23.0.2\bin\java.exeā€
[ThreadId 19] [SLCORE-ERR] Error: Could not find or load main class org.sonarsource.sonarlint.core.backend.cli.SonarLintServerCli
[ThreadId 19] [SLCORE-ERR] Caused by: java.lang.ClassNotFoundException: org.sonarsource.sonarlint.core.backend.cli.SonarLintServerCli
[ThreadId 11] Loaded settings from ā€œC:\Users\DougieJones\AppData\Roaming\SonarLint for Visual Studio\settings.jsonā€.
[DEBUG] [ThreadId 1] [ConnectedMode/GitMonitor] Monitoring git repo. Root path: C:\sd-is-sfs
[ThreadId 11] [NodeJSLocator] Checking environment variable SONAR_NODEJS_PATH
[ThreadId 40] [ConnectedMode/DotnetAnalyzerIndicator] Service Provider is unavailable
[DEBUG] [ThreadId 87] SLCore service is not available, telemetry is discarded
[ThreadId 11] [NodeJsLocator] Environment variable is not set
[ThreadId 20] [SLCore > Workspace Files > Tracking] Service Provider is unavailable
[ThreadId 75] [SLCoreAnalyzer] Analyzing C:\black-logde\src\TP\Services\DoughnutsAndCoffee.cs with id cd5253d9-63d7-4640-aa44-104149f72511
[ThreadId 75] [SLCoreAnalyzer] Analysis cd5253d9-63d7-4640-aa44-104149f72515 not ready for file C:\black-logde\src\TP\Services\DoughnutsAndCoffee.cs: Configuration scope not initialized
[ThreadId 11] [SLCoreHandler] SLCore instance exited
[ThreadId 11] [SLCoreHandler] Creating SLCore instance
[ThreadId 11] [SLCoreHandler] Starting SLCore instance
[DEBUG] [ThreadId 11] Using JRE location provided in the settings ā€œC:\jdk\openjdk-23.0.2_windows-x64_bin\jdk-23.0.2\bin\java.exeā€
[ThreadId 11] [NodeJSLocator] Checking environment variable SONAR_NODEJS_PATH
[ThreadId 11] [NodeJsLocator] Environment variable is not set
[ThreadId 11] Finished initializing the daemon package.
[ThreadId 1] Initializing the SonarQube for Visual Studio package…
[ThreadId 1] Finishing initializing the SonarQube for Visual Studio package
[ThreadId 83] [SLCORE-ERR] Error: Could not find or load main class org.sonarsource.sonarlint.core.backend.cli.SonarLintServerCli
[ThreadId 84] [SLCoreHandler] SLCore instance exited
[ThreadId 83] [SLCORE-ERR] Caused by: java.lang.ClassNotFoundException: org.sonarsource.sonarlint.core.backend.cli.SonarLintServerCli
[DEBUG] [ThreadId 84] [Notifications] Disabled notifications file does not exist. File: C:\Users\DougieJones\AppData\Roaming\SonarLint for Visual Studio\17\internal.notifications.json
[DEBUG] [ThreadId 1] [Roslyn Analyzers > To Update] Analyzer update. Registering the following analyzers:
SonarAnalyzer.CSharp, SonarAnalyzer.CSharp, Version=10.7.0.0, Culture=neutral, PublicKeyToken=null, C:\USERS\DougieJones\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\17.0_EC34336F\EXTENSIONS\EJY4TRRR.UIA\EmbeddedDotnetAnalyzerDLLs\SonarAnalyzer.CSharp.dll
SonarAnalyzer.VisualBasic, SonarAnalyzer.VisualBasic, Version=10.7.0.0, Culture=neutral, PublicKeyToken=null, C:\USERS\DougieJones\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\17.0_EC34336F\EXTENSIONS\EJY5TZVE.UIA\EmbeddedDotnetAnalyzerDLLs\SonarAnalyzer.VisualBasic.dll

Hello @padzeralu,

Thanks for trying the reinstallation and manually setting the JDK path. It’s definitely unexpected that you’re now encountering a ā€œCould not find or load main class… ClassNotFoundExceptionā€ error after that, especially since it worked fine on my test setup with JDK 23 you mentioned above. This suggests the issue might be environment-specific.

Given that the initial problem could have been related to security software or firewall interference, and this new error is also quite unusual for a standard setup, I’d like you to try a few things to help us narrow down the cause:

  1. Disable Other Visual Studio Extensions: There’s a possibility that another installed extension might be conflicting with SonarQube for Visual Studio. Could you please try disabling all other extensions (except for SonarQube for Visual Studio) and then restarting Visual Studio to see if the issue persists?
  2. Check Security Software/Firewall: Even though you’ve reinstalled, it’s worth double-checking if any security software (like antivirus or firewall) on your machine might be interfering with the SonarQube extension’s backend processes. Please review your security software settings and ensure that SonarQube for Visual Studio and any related processes are not being blocked.
  3. Re-check Embedded Java (Just in Case): I understand you might have already tried reverting to the embedded Java SE Runtime, but could you please double-check this again? To do this, ensure that the manually added JDK path is completely removed from the SonarQube for Visual Studio extension options within Visual Studio, so it is definitely using its own bundled Java. While I don’t have high hopes for this, it’s a quick check to definitively rule it out.

This is indeed a tricky situation, and I appreciate your patience as we try to figure out what’s going on. Please let me know the results of trying these steps, and provide any additional details you think might be relevant.

Thank you! :folded_hands: