Developer use developer way. You can hanker into idea.bat file and add below line to point any JRE before it start as below:
...
IF "%JRE%" == "" (
IF EXIST "%JDK_HOME%" (
SET "JRE=%JDK_HOME%"
) ELSE IF EXIST "%JAVA_HOME%" (
SET "JRE=%JAVA_HOME%"
)
)
**SET JRE=<YOU WANT>**
SET "JAVA_EXE=%JRE%\bin\java.exe"
IF NOT EXIST "%JAVA_EXE%" (
ECHO ERROR: cannot start IntelliJ IDEA.
ECHO No JRE found. Please make sure IDEA_JDK, JDK_HOME, or JAVA_HOME point to a valid JRE installation.
EXIT /B
)
...
But you need to setup very high version JDK for it as actually IDEA want us use self contain java but the version is very higher than the one which developer usually used. So it will contain one JDK version which is suitable for IDEA and add one ENV property like %IDEA_JDK% and point it when you install IDEA.
BUT if you didn't follow up all process when install or update IDEA( like didn't have permission and it also will be installed but it will install under your AppData folder and some env property will not be setup properly like $IDEA_JDK%).
In that case it will use local JDK based on your %JAVA_HOME%. And as we said, IDEA will use very high version than developer use, you will got below error like:
CompileCommand: exclude com/intellij/openapi/vfs/impl/FilePartNodeRoot.trieDescend
Error occurred during initialization of VM
java.lang.UnsupportedClassVersionError: com/intellij/util/lang/PathClassLoader has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
So you can set JRE to the self-contain JDK folder (usually under %IDEA_HOME%/jbr), it will works absolutely.