Could not find or load main class org.jetbrains.plugins.gradle.tooling.proxy.Main for projects in WSL

Answered

I just wanted to migrate some of my existing projects to my WSL2 Ubuntu 18.04 distribution. After installing OpenJDK 11 with apt and moving a project from Windows to Ubuntu, I tried to open it with IntelliJ. I added the JDK to the configured SDKs and set it as Project SDK in the Project Structure, then configured Gradle to use the Project SDK, but something seems to be broken.

No matter whether I open a project or create an entirely new one directly in the WSL and set the SDK in the New Project dialog, the project initialization fails with the error "Could not find or load main class org.jetbrains.plugins.gradle.tooling.proxy.Main for projects in WSL". The log contains a "org.gradle.tooling.GradleConnectionException: Operation result has not been received."

Things I have tried so far:

But nothing seems to work. Here is a clean idea.log containing everything from opening the IDE to opening the project and waiting until Gradle fails: Upload id: 2021_09_03_YEgDpg4DjmkBNCXY (file: idea.log)

Any help is greatly appreciated

5 comments
Comment actions Permalink

Please try to use Gradle wrapper.properties for the Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Use Gradle from as a workaround. Does it help?

1
Comment actions Permalink

Yes, that actually worked, thank you!
One interesting thing I noticed was that after setting "Use Gradle from" and opening the settings again, the input field is cleared and IntelliJ warns me about Gradle not being set, but the build still works, so the workaround, while quirky, is at least stable. Thanks for helping!

0
Comment actions Permalink

Shawn sorry, the submitter has restricted the visibility of the issue. This issue has been fixed in the latest IDE 2021.3.1 version.

0

Please sign in to leave a comment.