Java the weed
A longer story ...
Last updated
A longer story ...
Last updated
Java is like a weed: a plant whose growth cannot be controlled. As in real life, you have to check from time to time where it has installed itself and you have to remove it manually, because - at least in my Windows machine - not one JAVA SDK is listed under Apps.
The problem with that is that you never know which Java SDK (or run-time) is used when you use Java. The first one installed, the last one installed, the one with the highest version number ... what if there are two distributions with the same version, which one is updated automatically and so on.
To avoid unpredictable and unexpected results when using IntelliJ with Groovy you must control your Java installations!
One day, I recognized a growing list of SDKs in my IntelliJ project:
The first action I took was to search for "java.exe" which gave me some insight where to look for weed.
Alternatively, on Windows you can run where /R groovy.bat
and where /R java.exe
to find all SDK locations on your machine.
Actually, I wanted
one Java SDK and distribution (I use Amazon Corretto v23)
the ATOM SDK: C:\Program Files\Boomi AtomSphere\LocalAtom\jre\bin
Some applications, especially JetBrains Apps like IntelliJ, install their own, local run-time,, which you will want to keep!
You may use where java
on the command-line or you want to check the JAVA_HOME
environment variable:
and you will be confused even more!
Pick all the paths containing a java.exe which you don't want.
Delete these directories using a console window with ADMIN rights.
Close all JAVA apps
Close IntelliJ
Close all JetBrains apps, incl. ToolBox
Check Task Manager that Java isn't running anymore
Alternatively: log-off and log-on again
Unfortunately there are two (Windows) environment variables: for the current user and for system. The user setting has preference and the Corretto installation sets the system variable. Delete the user's JAVA_HOME and go with the just installed system setting:
IntelliJ will now list orphaned references:
Leave the ATOM JDK and remove all other entiries.
Add the one and only that you have just installed
Fix your Project Settings
* Make sure all your modules (normally there is only one) use the Project SDK
Open a new console window! If you had an open console, this has not recognized all the changes you made!
Find your preferred distribution, for example: .
Ensure you are running a complete installation incl. environment variables etc.