'InteliJ Idea in WSL2 error : export: ProgramFiles(x86): bad variable name

I'm getting the error

export: ProgramFiles(x86): bad variable name

when trying to run a java program on WSL2 from IntelliJ Idea. I can't seem to find any log or lead to this error. Any help would be appreciated.

Thanks.



Solution 1:[1]

Disabled EnvFile plugin, I resolved this problem.

Solution 2:[2]

I removed the .env files support and envFile dependencies

Solution 3:[3]

I know this isn't an exact answer, but I ran into the same problem. I removed a bunch of unused extensions and it solved the issue - sadly I don't know which was the culprit. So my advice is to disable all of your extensions and slowly enable them back to see which one is breaking it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Keisuke Miyaushiro
Solution 2 Chuy Cardoso
Solution 3 Jared